Can anyone check the script bellow and tell me if it will work and reset all user passwords in Zimbra 8.6?
Today our datacenter disabled our IP because one of our accounts was caught sending SPAM. I fear they will cancel our server if any other account is compromised. So I want to change all passwords for all users and then enforce new password rules.
Thank you!
Code: Select all
#!/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...";
USERNEWPASSWORD=$(cat /dev/urandom | tr -dc "a-zA-Z0-9!@#$%^&*()?" | fold -w 32 | head -n 1)
su - zimbra -c "zmprov sp $ACCOUNT $USERNEWPASSWORD";
echo "Done!"
echo ""
# read anykey
fi
done
echo "Modifying password for all user has been finished successfully"