Change password to all my accounts

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
lcuadros
Posts: 2
Joined: Thu Jul 13, 2017 9:25 pm

Change password to all my accounts

Post by lcuadros »

Hello there.

i wanna change all the passwords of my account mails to one, i need to migrate the data to a new host.

thx
User avatar
rioprayoga
Posts: 7
Joined: Mon Apr 17, 2017 4:45 am
Contact:

Re: Change password to all my accounts

Post by rioprayoga »

You can use this script for change password all account.

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…”;
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”
symmtech64
Posts: 1
Joined: Tue Oct 11, 2022 7:50 pm

Re: Change password to all my accounts

Post by symmtech64 »

Has anybody been successful in using this script to change all of the users in the Zimbra server? I realize that it is from 2017, but thought I would see if anybody modified it to work with the current version.
ghen
Outstanding Member
Outstanding Member
Posts: 264
Joined: Thu May 12, 2016 1:56 pm
Location: Belgium
ZCS/ZD Version: 9.0.0

Re: Change password to all my accounts

Post by ghen »

It will still work, but it will be extremely slow and ineffecient if you have a large number of accounts, since it's invoking zmprov (and thus starting a whole Java JVM) twice for every account.
Better make it just print all those "sp" (setPassword) statements and pipe them through a single zmprov instance on stdin.

That being said, you do not need to know (or change) user passwords to do a Zimbra server migration... So I'd question that requirement in the first place.
Post Reply