Script to change cpanel password for many users in server

First of all get all the users name in a file : users.txt

Then touch a file

chmod 755

Copy the following code to that file:

for i in `more users.txt`
randstring=`tr -dc _#$%^\&*\(\)\=A-Za-z0-9\~\+@! < /dev/urandom | head -c 8`
echo “$i $randstring” >> newpass.txt
/usr/local/cpanel/scripts/realchpass $i $randstring
/scripts/mysqlpasswd $i $randstring

Save the file and run the script :


When the script completes,Run the following command:


The new passwords with username will be available in the file : newpass.txt