Script to Change cPanel password of all accounts

Posted: March 21, 2014 in cPanel

1. Create a file named with the following contents in it.

cat /etc/trueuserdomains | awk ‘{print $2}’ | while read user; do
pass=`> passwords.txt
/scripts/realchpass $user $pass
/scripts/ftpupdate ===================================================================

2. Give executable permission to the script.

# chmod +x

3. Run the script and you will get a file named passwords.txt with all cpanel users with their new passwords.

# sh

You can use random string generate scripts like the following generate passwords.

pass=`date | md5sum | head -c16 | xargs`
pass=`openssl rand -base64 128 | head -c16 | xargs`
pass=`strings /dev/urandom | tr -dc .~?_A-Z-a-z-0-9 | head -c16 | xargs`


In some cases when executing /scripts/realchpass script will showing the following error.

ERROR: /usr/local/cpanel/scripts/realchpass
Invocation changes only the system
password and does not have any effect
on other services associated with your
cPanel account, including FTP, SSH,
WebDAV, and FrontPage. It is strongly
encouraged for you to change the
password via the WHM & cPanel
interface. You can force a password
change through this script by setting
the environment variable

You can fix the above error by running the following command. After that execute the script again.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s