Linux Web Hosting, DevOps, and Cloud Solutions

Change the passwords of all the cpanel accounts

Hi

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.

Steps:-

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
/scripts/ftpupdate
done

2. Give execution permission to the file you have craeted

chmod +x change.sh

3. Run the script

sh change.sh

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.

Exit mobile version