There will always be time when you need to change passwords of all the cpanel accounts. Following scripts will allow you to change the passwords of the accounts.
1. Create a file called change.sh and add following code in to it.
ls -1 /var/cpanel/users | while read user; do
# Generate a random password and assign it the variable pass
pass=`echo “$user $pass” >> new-passwords.txt
#Change the password of the account
/scripts/realchpass $user $pass
2. Give execution permission to the file you have craeted
chmod +x change.sh
3. Run the script
This script will change passwords of all the accounts and create a file called new-passwords.txt and stores the user name and passwords of each account in the file.