ZCS Administrator's Guide Open Source Edition 6.0, Rev 1
Table of Contents Previous Next Index


Appendix A Command-Line Utilities : Zimbra CLI Commands

Zimbra CLI Commands
The table below lists the CLI commands in /opt/zimbra/bin.
Check consistency of appointments and attendees in the Zimbra calendar
Start, stop, status of the Zimbra servers. Also can use to find the Zimbra version installed.
Start, stop, the conversion server or find the status of the converted attachments conversion/indexing
Start, stop, reload, or find the status of the mailbox components (mailboxd, MySQL, convert)
Performs all provisioning tasks in Zimbra LDAP, including creating accounts, domains, distribution lists and aliases
Ability to write Python scripts that access Zimbra Java libraries. It sets the ZCS class path and starts the Jython interpreter.
Outputs an XML configuration that describes the current state of the data gathered from zmstat-chart to generate charts on the administration console.
Start, stop, or find the status of the Swatch process, which is used in monitoring
Set the Web server mode to the communication protocol options: HTTP, HTTPS or mixed
Provides mechanism to process timezone changes from the command line
zmprov (Provisioning)
The zmprov tool performs all provisioning tasks in Zimbra LDAP, including creating accounts, aliases, domains, COS, distribution lists, and calendar resources. Each operation is invoked through command-line options, each of which has a long name and a short name.
The syntax for modify can include the prefix “+” or “-” so that you can make changes to the attributes affected and do not need to reenter attributes that are not changing.
The syntax is zmprov [cmd] [argument].
The following objects use this syntax:
The following example would add the attribute zimbraZimletUserProperties with the value “blue” to user 1 and would not change the value of any other instances of that attribute.
zmprov ma user1 +zimbraZimletUserProperties "com_company_testing:favoriteColor:blue"
 
--log property file
use Zimbra admin name/password from localconfig for admin/password
--authtoken (authtoken)
use auth token string (has to be in JSON format) from command line
--authtoken (authtoken file)
use auth token string (has to be in JSON format) from command line
The commands in the following table are divided into the tasks types - Account, Calendar Resources, Config, COS, Distribution List, Documents, Domain, Server, and Miscellaneous.
Short Name
zmprov aaa joe@domain.com joe.smith@engr.domain.com
Note: This command does not check the password age or history.
Syntax:{name@domain} {password} [attribute1 value1 etc]
{name@domain} {ds-type} {ds-name} [attr1 value1 [attr2 value2...]]
{name@domain} {identity-name} [attr1 value1 [attr2 value2...]]
{name@domain} {signature-name} [attr1 value1 [attr2 value2...]]
{name@domain|id|adminName} [attribute1 value1 etc]
zmprov ma joe@domain.com zimbraAccountStatus maintenance
{name@domain | id} {ds-name |ds-id} [attr 1 value 1 [attr2 value 2...]]
{name@domain |id} {identity-name} [attr 1 value 1 [attr 2 value 2...]]
{name@domain |id} {signature-name | signature-id} [attr 1 value 1 [attr 2 value 2...]]
zmprov raa joe@domain.com joe.smith@engr.domain.com
{name@domain|id} {newname@domain}
Note: Passwords cannot included accented characters in the string. Example of accented characters that cannot be used: ã, é, í, ú, ü, ñ.
{name@domain|id} {newName@domain}
This lists each COS, the COS ID and the number of accounts assigned to each COS
{alias-domain-name} {local-domain-name|id} [attr1 value1 [attr2 value2...]]
zmprov cd mktng.domain.com zimbraAuthMech zimbra
zmprov md domain.com zimbraGalMaxResults 500
Note: Do not modify zimbraDomainRenameInfo manually. This is automatically updated when a domain is renamed.
Note: renameDomain can only be used with “zmprov -l/--ldap
zmprov cc Executive zimbraAttachmentsBlocked FALSE zimbraAuthTokenLifetime 60m zimbraMailQuota 100M zimbraMailMessageLifetime 0
zmprov mc Executive zimbraAttachmentsBlocked TRUE
zmprov ms domain.com zimbraVirusDefinitionsUpdateFrequency 2h
Used to publish into nginx.conf what servers should be used for reverse proxy lookup.
Used to publish into saslauthd.conf what servers should be used for saslauthd.conf MTA auth
get DistributionListmembership
Before importing files, any file that will become a Documents page (wiki-style page), must be renamed to include the extension “.wiki”. If not it is imported as a file, accessed either as an attachment or an image.
{name@domain|id} {action} [{reindex-by} {value1} [value2...]]
When unread message count and quota usage are out of sync with the data in the mailbox, use this command to immediately recalculate the mailbox quota usage and unread messages count.
Important: Recalculating mailbox quota usage and message count should be schedule to run in off peak hours and used on one mailbox at a time.
[-s/--server hostname] {name@domain|id} {logging-category} {debug|info|warn|error}
[-s/ --server hostname] {name@domain|id} {logging-category}
When name@domain is specified, removes the custom logger created for the account otherwise removes all accounts all account loggers from the system.
See the zmprov Log Categories for a list of logging categories.
[-v] {ldap-query} [limit] [offset] [sortBy {attribute} [sortAscending 0|1] [domain {domain}]
{+|-} {dl-name@domain|id} {owner-name|owner-id} [{folder-path|folder-id}]
Prints all attribute names (account, domain, COS, servers, etc.).
Generates a pre-authentication key to enable a trusted third party to authenticate to allow for single-sign on. Used in conjunction with GenerateDomainPreAuth.
{domain|id} {name} {name|id|foreignPrincipal} {timestamp|0} {expires|0}
Used to publish into nginx.conf the servers that should be used for reverse proxy lookup
Used to publish into saslauthd.conf the servers that should be used for saslauthd.conf MTA auth
Examples
zmprov ca name@domain.com password
Create one account with a password that is assigned to a specified COS. You must know the COS ID number. To find a COS ID, type zmprov gc <COSname>.
zmprov ca name@domain.com password zimbraCOS cosIDnumberstring
zmprov ca name@domain.com ‘’
The empty single quote is required and indicates that there is no local password.
Using a batch process to create accounts, see Managing the zimbra Collaboration Suite chapter for the procedure.
zmprov aaa accountname@domain.com aliasname@domain.com
zmprov cdl listname@domain.com
zmprov adlm listname@domain.com member@domain.com
Change the administrator’s password. Use this command to change any password. Enter the address of the password to be changed.
zmprov sp admin@domain.com password
zmprov cd marketing.domain.com zimbraAuthMech zimbra
zmprov mcf zimbraDefaultDomain domain1.com
zmprov gac -v
zmprov gaa domain.com
zmprov gaa -v domain.com
zmprov +zimbraServiceEnabled logger
Then type zmloggerctl start, to start the logger.
To modify the purge interval, set zimbraMailPurgeSleepInterval to the duration of time that the server should “sleep” between every two mailboxes. Type:
zmprov ModifyServer <server-name> zimbraMailPurgeSleepInterval <Xm>
X is the duration of time between mailbox purges; m represents minutes. You could also set <xh> for hours.
Modify zimbraNewMailNotification to customize the notification email template. A default email is sent from Postmaster notifying users that they have received mail in another mailbox. To change the template, you modify the receiving mailbox account. The variables are
You can specify which of the above variables appear in the Subject, From, or Body of the email. The following example is changing the appearance of the message in the body of the notification email that is received at name@domain.com. You can also change the template in a class of service, use zmprov mc. The command is written on one line.
zmprov ma name@domain.com zimbraNewMailNotificationBody ‘Important message from ${SENDER_ADDRESS}.${NEWLINE}Subject:${SUBJECT}’
zmprov Log Categories
 
        zimbra.account
 
 
zmaccts
This command runs a report that lists all the accounts, their status, when they were created and the last time anyone logged on. The domain summary shows the total number of accounts and their status.
Syntax
zmaccts
zmcalchk
This command checks the consistency of appointments on the Zimbra calendar and sends an email notification regarding inconsistencies. For example, it checks if all attendees and organizers of an event on the calendar agree on start/stop times and occurrences of a meeting.
See the output of zmmailbox help appointment for details on time-specs.
Syntax
zmcalchk [-d] [-n <type>] <user> <start-time-spec> <end-time-spec>
Description
 
Short Name
Allows the user to specify the maximum number of attendees to check. The default value is 50.
Send email notifications to selected users if they are out of sync for an appointment
 
 
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]
Description
 
Short Name
Shutdown all services and manager on this host. When the manager is shutdown, you cannot query that status.
 
 
 
zmcertmgr
The CLI command zmcertmgr is used to manage your certificates from the command line. You can use the administration console to easily view, update and install self-signed and commercial certificates. See the administration console help for more information about using this tool.
Syntax
zmcertmgr {attribute} [arg]
Description
 
<self|comm> [-new] [subject] [-subjectAltNames “host1,host2”]
zmgsautil
The CLI command zmgsautil can be used to create or delete the GAL sync account and to force syncing of the LDAP data to the GAL sync account.
A GAL sync account is created when the GAL is configured on a domain. This account is created and the polling interval for performing a full sync is managed from the administration console.
To see attributes and settings for a GAL sync account, run zmprov gds against the account.
 
Creates the GAL sync account. This should be done from the administration console.
Deletes the GAL sync account and the references to the LDAP server. The account can also be deleted from the administration console.
trickleSync [-a {galsynceaccountname}|-i {account-id}] [-d {datasource-id}] [-n {datsource-name}]
The datasource ID the LDAP datasource ID. The datasource name is the name of the address book (folder) in the GAL account created to sync LDAP to.
This syncs all LDAP contact data. You can also set this from the administration console.
fullSync [-a {galsynceaccountname}|-i {account-id}] [-d {datasource-id}] [-n {datsource-name}]
This should be used to reload the entire GAL if there is change in the filter, attribute mapping or LDAP server parameters.
forceSync [-a {galsynceaccountname}|-i {account-id}] [-d {datasource-id}] [-n {datsource-name}]
zmldappasswd
The CLI command zmldappasswd changes the LDAP password on the local server. In multi node environments, this command must be run on the LDAP master server only.
This CLI command used with options changes other passwords.
For better security and audit trails the following passwords are generated in ZCS:
LDAP Admin password. This is the master LDAP password. This is not new, but has been renamed.
LDAP Root password. This is used for internal LDAP operations.
LDAP Postfix password. This is the password used by the postfix user to identify itself to the LDAP serve and must be configured on the MTA server to be the same as the password on the LDAP master server.
LDAP Amavis password. This is the password used by the amavis user to identify itself to the LDAP server and must be configured on the MTA server to be the same as the password on the LDAP server.
LDAP Replication password. This is the password used by the LDAP replication user to identify itself to the LDAP master and must be the same as the password on the LDAP master server.
Syntax
opt/zimbra/bin/zmldappasswd [-h] [-r] [-p] [-l] new password
Description
 
Changes ldap_amavis-password
Changes ldap_replication_password
Changes ldap_postfix_password
Changes ldap_root_passwd
zmlocalconfig
This command is used to set or get the local configuration for a zimbra server.
Syntax
zmlocalconfig [options]
To see the local config type zmlocalconfig
Description
Short Name
<arg> File in which the configuration is stored
Edit the configuration file, change keys and values specified. The [args] is in the key=value form.
Edit the keys whose change is known to be potentially dangerous
<arg> Shows the values in one of these formats: plain (default), xml, shell, nokey.
Shows the values for only those keys listed in the [args] that have been changed from their defaults
This option is used with the edit option. Specified key is set to a random password string.
Remove a configuration key. If this is a key with compiled-in defaults, set its value to the empty string.
zmmailbox
The zmmailbox tool is used for mailbox management. The command can help administrators provision new mailboxes along with accounts, debug issues with a mailbox, and help with migrations.
You can invoke the zmmailbox command from within the zmprov command. You enter selectMailbox within zmprov to access the zmmailbox command connected to that specified mailbox. You can then enter zmmailbox commands until you type exit. Exit returns you to zmprov. This is useful when you want to create accounts and also pre-create some folders, tags, or saved searches at the same time.
Syntax
zmmailbox [args] [cmd] [cmd-args ...]
Description
 
Short Name
http[s]://{host}[:{port}] server hostname and optional port. Must use admin port with -z/-a
use zimbra admin name/password from localconfig for admin/password
--authtoken (authtoken)
use authtoken string (has to be in JSON format) from command line
--authtoken (authtoken file)
use authtoken string (has be in JSON format) from command line
Specific CLI tools are available for the different components of a mailbox. Usage is described in the CLI help for the following.
 
Examples
When you create an account, you may want to pre-create some tags and folders. You can invoke zmmailbox inside of zmprov by using “selectMailbox(sm)”
 
zmtlsctl
This command is used to set the Web server mode to the communication protocol options: HTTP, HTTPS, Mixed, Both and Redirect.
Mixed mode redirects to HTTPS for login and HTTP for normal session traffic.
Both mode means that an HTTP session stays HTTP, including during the log in phase, and an HTTPS session remains HTTPS throughout, including the log in phase.
Redirect mode redirects any users connecting via HTTP to a HTTPS connection.
Mailboxd has to be stopped and restarted for the change to take effect.
Note: If you switch to HTTPS, you use the self-signed certificate generated during ZCS installation, in /opt/zimbra/ssl/zimbra/server/server.crt.
Syntax
zmtlsctl [mode]
mode = http, https, mixed, both, redirect
Steps to run
 
1.
Type zmtlsctl [mode].
2.
Type zmmailboxdctl stop.
3.
 
 
zmmetadump
This command is a support tool that dumps the contents of an item’s metadata in a human readable form.
Syntax
zmmetadump -m <mailbox id/email> -i <item id>
or zmmetadump -f <file containing encoded metadata>
zmmypasswd
This command is used to change zimbra_myql_password. If the --root option is specified, the mysql_root_passwd is changed. In both cases, MySQL is updated with the new passwords. Refer to the MySQL documentation to see how you can start the MySQL server temporarily to skip grant tables, to override the root password. This requires a restart for the change to take effect.
Syntax
zmmypasswd [--root] <new_password>.
zmproxyconfgen
This command generates the nginx proxy configuration files. It reads LDAP settings to replace template variables and generates the final nginx configuration.
Syntax
ProxyConfGen [options]
Description
 
Short Name
<arg> Overrides a config variable. The <arg> format should be name=value. To see a list of names, use -d or -D
Prints the Definitions variable map after loading LDAP configuration and processing overrides
<arg> Displays the directory path (relative to $workdir/conf), where included configuration files are written
Specifies not to write configuration and only display the files that would be written
<arg> Displays the config file prefix. The default value is nginx.conf
<arg> Displays the template file prefix. The default value is $prefix
<arg> Specifies a valid server object. Configuration is generated based on the specified server’s attributes. The default is to generate configuration based on global configuration values
<arg>Specifies the proxy template directory. The default value is $workdir/conf/nginx/templates
<arg> Specifies the proxy working directory. The default value is /opt/zimbra
zmproxypurge
This command purges POP/IMAP proxy routing information from one or more memcached servers. Available memcached servers are discovered by the zmprov gamcs function. Others can be specified if necessary using the server port.
Syntax
ProxyPurgeUtil [-v] [-i] -a account [-L accountlist] [cache1 [cache2...]]
Description
 
Short Name
Displays file containing list of accounts, one per line
Specifies the format to be used for printing routing information with information. The fields that display by default are
(optional command) Specifies additional memcache server in the form of server:port
zmskindeploy
This command simplifies the process of deploying skins in ZWC. This tool processes the skin deployment, enables the skin for all users of the ZWC deployment, and restarts the web server so that it recognizes the new skin.
For more information about this tool, see http://wiki.zimbra.com/index.php?title=About_Creating_ZCS_Themes
Syntax
zmskindeploy <path/to/skin/dir/or/zipfile>
zmsoap
Prints mail, account, and admin information in the SOAP format.
Syntax
zmsoap [options] <path1 [<path2>...]
Description
 
Short Name
<name> Displays mailbox account name. Mail and account requests are sent to this account.
This attribute is also used for authentication if -a and -z are not specified
<name>Displays the target account name to which the requests are sent. Used only for non-admin sessions
<name>Displays the admin account name to authenticate as
Displays the Zimbra admin name and password to authenticate as
<path> Displays the root element path. If specified, all path arguments that do not start with a slash (/) are relative to this element
<type> Displays the SOAP request type. Can either be mail, account, or admin
<http[s]://...> Displays the server hostname and optional port value
<[path...]> Displays the element or attribute path and value. Roughly follows the XPath syntax as:
zmstat-chart
This command is used to collect statistical information for the CPU, IO, mailboxd, MTAqueue, MySQL, and other components and to run a script on the csv files to display the usage details in various charts. These csv files are saved to /opt/zimbra/zmstat/.
You must enable zmstat to collect the performance charts data.
To enable zmstat for charting on each server
 
1.
Enter zmprov ms {hostname} zimbraServerEnable : stats.
2.
zmcontrol stop
zmcontrol start
Syntax
zmstat-chart -s <arg> -d <arg> [options]
Description
 
Short Name
<arg> If this is specified, the aggregate computation ends at this timestamp. Usage is MM/dd/yyyy HH:mm:ss.
<arg> If this is specified, the aggregate computation starts at this timestamp. Usage is MM/dd/yyyy HH:mm:ss.
<arg> If this is specified, all samples after the specified timestamp are ignored. Usage is MM/dd/yyyy HH:mm:ss.
<arg> If this is specified, all samples before this timestamp are ignored.
<arg> This gives the chart a title that displays. Defaults to the last directory name of srcdir.
<arg> The directory where the generated chart files are saved.
One or more directories where the csv files are located. The csv files are moved to directories listed by date under zmstat/.
zmstat-chart-config
This command generates an xml file /opt/zimbra/conf/zmstat-chart.xml from a template, taking into account the server setup including the LDAP node and the processes run, among other specifications.
zmstatctl
This is a control script for checking zmstat data collectors. It starts or stops monitoring processes, checks status or rotates logs.
Syntax
zmstatctl start|stop|status|rotate
zmthrdump
This command invokes a thread dump in the ZCS server process and prints the output file. It also gives the option of saving the thread dump to a file and inserts a timestamp on the logfile.
Syntax
zmthrdump [-h] [-i] [-t <timeout seconds>] [-p <pid file>] [-f <file>] [-o <out-file>]
Description
 
Short Name
Appends the timestamp to the LOGFILE before invoking SIGQUIT
Returns the PID to send SIGQUIT. The default value can be found in zmmailboxd_java.pid
Specifies the LOGFILE to save the thread dump output in. The default value is zmmailbox.out
Specifies the output file of the thread dump. The default value is stdout
Specifies the timeout value (in seconds) to exit if the process becomes unresponsive. The default value is 30 seconds.
zmtrainsa
This command is used to train the anti-spam filter. This command is run automatically every night to train the SpamAssasin filter from messages users mark as “junk” “not junk” from their mailbox. See Anti-Spam Training Filters.
The zmtrainsa command can be run manually to forward any folder from any mailbox to the spam training mailboxes. If you do not enter a folder name when you manually run zmtrainsa for an account, for spam, the default folder is Junk. For ham, the default folder is Inbox.
Syntax
zmtrainsa <user> spam|ham [folder]
zmtzupdate
This command is used to update time zone changes in existing appointments for specific users or all users. A .ics rule file should first be created to run with this command. A rule file lists a series of rules to match a time zone and the replacement time zone definitions. More information about this command can be found at http://wiki.zimbra.com index.php?title=Changing_ZCS_Time_Zones
Syntax
zmtzupdate --rulefile <rule file> -a <“all” or list of specific email addresses> [--sync] [--after <date/time stamp>]
Description
Short Name
<arg> account email addresses separated by a white space. Use “all” for all accounts to be updated
<arg> Appointments occurring after the specified date/time in this field are updated. The default cut off time is January 1st, 2008
Specifies the .ics XML file that should be used to update time zone definitions
<arg> Specifies the mail server hostname. The default value is localhost
If specified, this option causes the zmtzupdate command to block till the server processes all requested accounts. The default value is no.
zmvolume
This command can be used to manage storage volumes from the CLI. Volumes can be easily managed from the administration console, Server, Volume tab.
Syntax
zmvolume {-a|-d|-l|-e|-dc|-sc} [options]
Description
 
Short Name
<arg> Compress BLOBs; “true” or “false”
--compressionThreshold
<arg> Volume ID
<arg> Volume name
<arg> Root path
<arg> Mail server hostname. Default is localhost.
<arg> Volume type (primaryMessage, secondaryMessage, or index)
zmzimletctl
This command is used to manage Zimlets and to list all zimlets on the server. See Working with Zimlets. Most Zimlet deployment can be competed from the zimbra administration console.
Syntax
zmzimletctl {-l} {command} <zimlet.zip|config.xml|zimlet>Description
Short Name
<zimlet.zip> Creates the Zimlet entry in the LDAP server, installs the zimlet files on the Server, grants, access to the members of the default COS, and turns on the Zimlet
<zimlet> Uninstall a zimlet from the zimbra server
<zimlet.zip> Installs the Zimlet files on the host
<zimlet> Adds the Zimlet entry to the LDAP
<zimlet> Enables the Zimlet
<zimlet> Disables the Zimlet
<zimlet> <cos1> {grant|deny} [<cos2> {grant|deny}...] Sets the access control, grant|deny, to a COS
<zimlet> Lists the ACLs for the Zimlets
<zimlet.zip> Extracts the configuration template from the Zimlet.zip file
<config.xml>Installs the configuration
<zimlet> Sets the Zimlet priority
zmproxyconfig
This command is used to manage Zimbra proxy and should only be used when you have to make changes to Zimbra proxy after it has been installed. See Chapter 6, Working with Zimbra Proxy.
Syntax
./zmproxyconfig [-h] [-o] [-m] [-w] [-d [-r] [-s] [-a w1:w2:w3:w4] [-i p1:p2:p3:p4] [-p p1:p2:p3:p4] [-x mailmode]] [-e [-a w1:w2:w3:w4] [-i p1:p2:p3:p4] [-p p1:p2:p3:p4] [-x mailmode]] [-f] -H hostname
Description
 
Short Name
Colon separated list of Web ports to use. Format: HTTP-STORE:HTTP-PROXY:HTTPS-STORE:HTTPS-PROXY (Ex: 8080:80:8443:443)
Colon separated list of IMAP ports to use. Format: IMAP-STORE:IMAP-PROXY:IMAPS-STORE:IMAPS-PROXY (Ex: 7143:143:7993:993)
Colon separated list of POP ports to use. Format: POP-STORE:POP-PROXY:POPS-STORE:POPS-PROXY (Ex: 7110:110:7995:995)
Run against a remote host. Note that this requires the server to be properly configured in the LDAP master
Disable reverse proxy lookup target for the store server. Only valid with -d. Make sure that you intend for all proxy functions for the server to be disabled.
hostname is the value of the zimbra_server_hostname LC key for the server being modified.
 

Appendix A Command-Line Utilities : Zimbra CLI Commands

Table of Contents Previous Next Index
ZCS Administrator's Guide Open Source Edition 6.0, Rev 1
Copyright © 2009 Zimbra Inc.