Zimbra CLI Commands: User Accounts Management

In Zimbra you can manage accounts by creating them and adding or changing features both from administration console and from the Command Line Tools (CLI).

In this article, in particular, we’re going to see how to manage user accounts through CLI commands, using zmprov. For every command, we will show you the extendend and short form, the syntax to be used and an example to better help you understand how it works.

All commands are intended to be executed logging in as Zimbra user, with the command: su – zimbra

ACCOUNT PROVISIONING COMMANDS

Create Account:

To create an account the command to use is: CreateAccount (ca). Below is the syntax:

zmprov CreateAccount {user@yourdomain} {passwd} [attribute1 value1 etc]

Example:

zmprov CreateAccount john@yourdomain.com pwd123 displayName JBrown

Delete Account:

To delete account, you have to use the following command: DeleteAccount (da). Below is the syntax:

zmprov DeleteAccount {user@yourdomain|id|adminName}

Example:

zmprov DeleteAccount john@yourdomain.com

Get Account Membership:

In order to get account membership, we are going to use this command: GetAccountMembership (gam). Below is the syntax:

zmprov GetAccountMembership {user@yourdomain|id}

Get Account:

To get an account, you have to use the following command: GetAccount (ga). Below is the syntax:

zmprov GetAccount {user@yourdomain|id|adminName}

Example:

zmprov GetAccount john@yourdomain.com

Get All Accounts:

To get all accounts, you have to use the following command: GetAllAccounts (gaa). Below is the syntax:

zmprov GetAllAccounts [-v] [{yourdomain}]

Example:

zmprov GetAllAccounts -v yourdomain.com

The -v attribute, stands for verbose. Verbose mode dumps full exception stack trace

Get All Admin Accounts:

To get all admin accounts, you have to use a similar command to the above one: GetAllAdminAccounts (gaaa). Below is the syntax:

zmprov GetAllAdminAccounts

Modify Account:

If you want to modify an account the command you need to use is the following one: ModifyAccount (ma). Below is the syntax:

zmprov ModifyAccount {user@yourdomain|id|adminName} [attribute1 value1 etc]

Example:

zmprov ModifyAccount john@yourdomain.com zimbraAccountStatus maintenance

Rename Account:

To rename an account the command to be used is: RenameAccount (ra). Below is the syntax:

zmprov RenameAccount {user@yourdomain|id} {newusername@yourdomain}

Example:

zmprov RenameAccount john@yourdomain.com john123@yourdomain.com

Set Password:

If you want to set a password to your account, you have to use the following command: SetPassword (sp). Below is the syntax:

zmprov SetPassword {user@yourdomain|id|adminName} {passwd}

Example:

zmprov SetPassword john@yourdomain.com pwd123

Account Alias:

You can add or remove an alias account.

To add an account alias, the command to be used is: AddAccountAlias (aaa), and the syntax is:

zmprov AddAccountAlias {user@yourdomain|id|adminName} {aliasname@yourdomain}

Example:

zmprov AddAccountAlias john@yourdomain.com john.brown@yourdomain.com

To remove an account alias, the command to be used is: RemoveAccountAlias (raa), and the syntax is:

zmprov RemoveAccountAlias {user@yourdomain|id|adminName} {aliasname@yourdomain}

Example:

zmprov RemoveAccountAlias john@yourdomain.com john.brown@yourdomain.com

Search Accounts:

You can search accounts using the following command: SearchAccounts (sa). Below is the syntax:

zmprov SearchAccounts [-v] {ldap-query} [limit] [offset] [sortBy {attribute}]

Set Account Class of Service:

To set an account COS, all you have to do is to use the command SetAccountCOS (sac)with the following syntax:

zmprov SetAccountCOS {user@yourdomain|id|adminName} {cos-name|cos-id}

Example:

zmprov SetAccountCOS john@yourdomain.com SampleRole

There are some other commands you can use when you manage accounts on your server. Here is a short list of main categories of them. Click on the name of each one for a complete guide on specific commands:

Technical writer at Zextras. Linux and technology enthusiast. He describes himself as an atypical and polyhedric IT expert, thanks to a creative and open minded attitude, and to the experience gained over time as an IT technician, system engineer and developer.

Post your comment