Frequently Used Zimbra CLI
The Zimbra administration console is usually used as the mail tool for configuring and maintaining Zimbra. But actually, some Zimbra function can only be changed using the Command Line Interface (CLI) utility.
The CLI utility can be used for the following:
• Provisioning accounts
• Starting and stopping a service
• Installing self-signed certificates
• Local configuration
In this article I will list some CLI that frequently used. Before we start with the list, let’s see some notes about Zimbra CLI. I take these notes from Zimbra documentation.
General Tool Information
The Zimbra command-line utilities follow standard UNIX command-line conventions. Follow these guidelines when using the commands
• CLI commands are run as the zimbra user, that is su – zimbra.
• The actual CLI commands are case-sensitive. You must type them in lower case.
• Press ENTER after you type a command.
• Typing the CLI command and then – h displays the usage options for the command. Example: zmprov – h lists all the options available for the zmprov utility.
• Each operation is invoked through command-line options. Many have a long name and a short name. For example, these two commands are equivalent:
zmprov createAccount [email protected] test123
zmprov ca [email protected] test123
Syntax Conventions
When demonstrating the syntax of each tool, the following conventions indicate required, optional, and alternate values:
• {attribute} in curly brackets is required information.
• [attribute] in square brackets are optional arguments or information.
• {a|b|c} or [a|b|c] options separated by the pipe character | means “a” OR “b” OR “c”
• For attribute names that may contain spaces, surround the name with double quotes.
Location of Command-Line Utilities
The command-line tools available for administrators are all located in the /opt/zimbra/bin directory on the Zimbra server.
Zimbra CLI Commands
Here are some frequently used Zimbra CLI.
Account Provisioning Commands
Long Name | Short Name | Syntax Example |
createAccount | ca | Syntax:{name@domain} {password} [attribute1 value1 etc]
zmprov ca [email protected] test123 displayName JSmith |
deleteAccount | da | Syntax:{name@domain|id|adminName}
zmprov da [email protected] |
getAccountMembership | gam | {name@domain|id}
zmprov gam [email protected] |
getAccount | ga | Syntax:{name@domain|id|adminName}
zmprov ga [email protected] |
getAllAccounts | gaa | Syntax: [-v] [{domain}]
zmprov gaa zmprov gaa -v domain.com |
getAllAdminAccounts | gaaa | Syntax: gaaa
zmprov gaaa |
modifyAccount | ma | {name@domain|id|adminName} [attribute1 value1 etc]
zmprov ma [email protected] zimbraAccountStatus maintenance |
setPassword | sp | {name@domain|id|adminName} {password}
zmprov sp [email protected] test321 |
addAccountAlias | aaa | {name@domain|id|adminName} {alias@domain}
zmprov aaa [email protected] [email protected] |
removeAccountAlias | raa | {name@domain|id|adminName} {alias@domain}
zmprov raa [email protected] [email protected] |
setAccountCOS | sac | {name@domain|id|adminName} {cos-name|cos-id}
zmprov sac [email protected] RegularUsers |
renameAccount | ra | {name@domain|id} {newname@domain}
zmprov ra [email protected] joe23@domain |
Distribution List Provisioning Commands
Long Name | Short Name | Syntax Example |
createDistributionList | cdl | {list@domain}
zmprov cdl [email protected] |
addDistributionListMember | adlm | {list@domain|id} {member@domain}
zmprov adlm [email protected] [email protected] |
removeDistributionListMember | rdlm | {list@domain|id}
zmprov rdlm [email protected] [email protected] |
deleteDistributionList | ddl | (list@domain|id}
zmprov ddl [email protected] |
COS Provisioning Commands
Long Name | Short Name | Syntax Example |
createCos | cc | {name} [attribute1 value1 etc]
zmprov cc Executive zimbraAttachmentsBlocked FALSE zimbraAuthTokenLifetime 60m zimbraMailQuota 100M zimbraMailMessageLifetime 0 |
deleteCos | dc | {name|id}
zmprov dc Executive |
getCos | gc | {name|id}
zmprov gc Executive |
getAllCos | gac | [-v]
zmprov gac -v |
modifyCos | mc | {name|id} [attribute1 value1 etc]
zmprov mc Executive zimbraAttachmentsBlocked TRUE |
renameCos | rc | {name|id} {newName}
zmprov rc Executive Business |
zmmsgtrace
This command is used to trace an email message that was sent or received
with the last 30 days.
Syntax
zmmsgtrace {-i|-s|-r|-F} <message_id>
Long Name | Short Name | Description |
–help | -h | Shows the help for the usage options for this tool. |
-i | Message ID. | |
-s | Sender address. | |
-r | Recipient address. | |
-F | From_ip/host | |
-D | Dest_ip/host | |
-t | start, end times in YYYYMMDD (hhmmss) format |
Example
zmmsgtrace -s [email protected]
zmmsgtrace -r [email protected]
zmmsgtrace -s [email protected] -t 20090701
zmmsgtrace -s [email protected] -r [email protected] -t 20090701
zmcontrol (Start/Stop Service)
This command is run to start or to stop services. You can also find which version of the zimbra Collaboration Suite is installed.
Syntax
zmcontrol [ -v -h ] command [args]
Long Name | Short Name | Description |
-v | Displays ZCS software version. | |
-h | Displays the usage options for this command | |
-H | Host name (localhost). | |
Command in… | ||
maintenance | Toggle maintenance mode. | |
shutdown | Shutdown all services and manager on this host. When the manager is shutdown, you cannot query that status | |
start | Startup manager and all services on this host | |
startup | Startup manager and all services on this host | |
status | Returns services information for the named host | |
stop | Stop all services but leave the manager running. |
–