Sometimes we may want to reset the user password for a while, such as setting up a new system or migration from the old mail server and want to clean up old password.

Below are a simple script to bulk-reset Zimbra account password :

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

for ACCOUNT in $USERS; do
ACC1=`echo $ACCOUNT | awk -F@ '{print $1}'`;
ACC=`echo $ACC1 | cut -d '.' -f1`;

if [ $ACC == "admin" ] || [ $ACC == "wiki" ] || [ $ACC == "galsync" ] || [ $ACC == "ham" ] || [ $ACC == "spam" ]; then
echo "Skipping system account, $NAME...";
echo "Modifying $ACCOUNT password...";
su - zimbra -c "zmprov sp $ACCOUNT NewGeneratedPassword";
su - zimbra -c "zmprov ma $ACCOUNT zimbraPasswordMustChange TRUE;
echo "Done!"
echo ""
# read anykey
echo "Modifying password for all user has been finished successfully"

Note : I think it would be better to include some personal ID (part of user name or any fields) into generated-password so all password will be a semi-random password. In my case, I’m using user birth date or part of their name for their generated password to prevent anyone trying to login to any mailbox. It’s not really secure but in my case, it was sufficient for temporary purpose.

3 Thoughts on “Zimbra Mail Server Tips : Bulk Reset Account Password

  1. Chris on October 16, 2014 at 10:01 said:

    So this randomly generates a password? How do you know what the passwords are afterwards for them to login and change them…?

  2. Phuc Ngo on April 27, 2015 at 11:38 said:

    If i want all password to be same, how i do?

  3. Masim "Vavai" Sugianto on April 27, 2015 at 12:00 said:

    @Phuc Ngo,

    Just replace “NewGeneratedPassword” with your password

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Post Navigation