Hi Dude, how to modify account zimbra set to specific class of service? In this article i will share some simple method. We can execute using the command if only one or two accounts. But what if there are hundreds of accounts? we can do it iteratively with script. This is simple method for Zimbra Modify Account COS.
Method 1: With Modify Account
This is first method with Zimbra Modify Account command. Before doing this, we must first know the COS ID. For that, we need the “grep” command.
Login as Zimbra User.
Get COS ID
Follow this command to get COS ID.
[root@mail2 ~]# su - zimbra
Last login: Thu Feb 16 09:36:01 WIB 2023 on pts/6
[zimbra@mail2 ~]$ zmprov -l gac
default
defaultExternal
name-of-cos
After get name of COS, grep the Zimbra ID.
[zimbra@mail2 ~]$ zmprov gc name-of-cos | grep -i 'zimbraId'
zimbraId: 2f3048b6-63e3-400e-99a3-d75c6faf0ef6
After get zimbra ID, we can modify account like below.
zmprov ma [email protected] zimbraCOSId "2f3048b6-63e3-400e-99a3-d75c6faf0ef6"
For bulk account, we create a file that contains a list of emails. As an example.
vim cos-staff.txt
[email protected]
[email protected]
[email protected]
Save, and execute this command.
for i in `cat cos-staff.txt `; do zmprov ma $i zimbraCOSId "2f3048b6-63e3-400e-99a3-d75c6faf0ef6" ;echo $i ;done
Method 2: With Set Account COS
As Zimbra user, run this command.
zmprov setAccountCos [email protected] NAME-COS
zmprov setAccountCos [email protected] NAME-COS
For bulk account, create script bash file example set-cos-account.sh.
vim set-cos-account.sh
#!/bin/bash
clear
echo "Retrieve zimbra user name..."
USERS=`cat cos-staff.txt`;
for ACCOUNT in $USERS; do
NAME=`echo $ACCOUNT`;
echo "Set COS for $NAME..."
su - zimbra -c "zmprov setAccountCos ${ACCOUNT} NAME-COS";
done
echo "COS All Account Set Successfull"
Finish, we already done modify account for COS. That is simple step Zimbra Modify Account COS.