You may need to change the password of all your cPanel accounts in case of a potential security threat. But doing it manually will take a lot of time, especially if you have hundreds of cPanel accounts.

You can automate this process with simple shell scripts.

Step 1: SSH to your VPS with the root user.

Step 2: Create a new file using your favorite editor. In our case, we have created a file change-cpanel-pass.sh. and add the below script 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-passwords.txt
/scripts/realchpass $user $pass
/scripts/ftpupdate
done

Step 3: Save the file and give it executable permission to the script.

# chmod +x changecpanelpass.sh

Step 4: Execute the script using the command sh changecpanelpass.sh

This script will change the passwords of all the cPanel accounts and create a file named new-passwords.txt, which contains all the passwords.

Was this answer helpful? 1 Users Found This Useful (2 Votes)