Zimbra Tips : How To Set COS (Class Of Service) for All Users

Posted by

Few days ago, i am migrating Zimbra mail server from OSE version to NE version. The migrating process working fine from migrating Account, Password, Alias Account, Distribution List, Mailboxes and etc. All account after migration still using default value on new Zimbra NE. My client want the new Zimbra NE using value/parameter like Class Of Services on old Zimbra. Create the COS on new Zimbra with the same name/value/features like COS on old Zimbra. After created, the new COS applied to all account with the following command.

zmprov sac accountname cosname

example

zmprov sac admin@example.com staff

Note :

The above command will modify COS for admin@example.com account with COS name staff. If you want to set COS for all account, you can make a script as below

vi /srv/set-cos.sh

Fill with the following line

#!/bin/bash

clear
rm /srv/modify-cos.zmp
echo "Retrieve zimbra user name..."

USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;

for ACCOUNT in $USERS; do
echo "Modify COS for account $ACCOUNT"
echo "sac $ACCOUNT staff" >> /srv/modify-cos.zmp
done

Give execute access and run the above script

chmod +x /srv/set-cos.sh
sh /srv/set-cos.sh

The result of the above script is file with name modify-cos.zmp which is located in /srv/ folder. Execute it file with the following command as user Zimbra

su - zimbra
zmprov < /srv/modify-cos.zmp

Good luck and hopefully useful 😀

3 comments

Leave a Reply to iman Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.