Friday, 8 March 2013

Script to change the passwords of all cPanel accounts

You may need to change passwords of all the cpanel accounts sometimes because of the security concerns. Following script will allow you to change the passwords of all the accounts.

1. Create and open a file “” in your favorite editor and add following details to it.
#! /bin/bash
ls -1 /var/cpanel/users | while read user; do
pass=`</dev/urandom tr -dc “A-Za-z0-9*-/+.*=_\|\\#” | head -c16
echo “$user $pass” >> new-pass.txt
/scripts/realchpass $user  $pass

2. Give executable permission to our script.
# chmod +x

3. Execute the script.
# sh

The script will change all the passwords of cPanel and ftp accounts and create text file with the name ” new-pass.txt” which contains all the new passwords.