facebooktwittergoogle_plusredditpinterestlinkedinmail

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 :

#!/bin/bash
clear
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...";
else
echo "Modifying $ACCOUNT password...";
su - zimbra -c "zmprov sp $ACCOUNT NewGeneratedPassword";
su - zimbra -c "zmprov ma $ACCOUNT zimbraPasswordMustChange TRUE;
echo "Done!"
echo ""
# read anykey
fi
done
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.

One Thought 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…?

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=""> <strike> <strong>

Post Navigation