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 script.sh

chmod 755 script.sh

Copy the following code to that file:

#!/bin/bash
for i in `more users.txt`
do
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 :

sh script.sh

When the script completes,Run the following command:

/scripts/ftpupdate

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

DONE!