Shell script to change multiple cPanel account password.

You may need to change the password of all your cPanel account 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 by simple shell scripts.

  1. SSH to your VPS with root user.

  2. Create a new file using your favorite editor. In our case, we have created file changecpanelpass.sh and add the below script on 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	
  3. Save the file and give it provide executable permission to the script.

    chmod +x changecpanelpass.sh
  4. Execute the script using command sh changecpanelpass.sh

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

Related Articles

How To Automatically Delete Forwarded Mails in cPanel?

You can use cPanel email forwarder option to forward your emails to any other email account....

How to create and view phpinfo file in cPanel?

It is a very important and useful function of PHP to return information. It includes information...

How do I enable ExecCGI via .htaccess file?

You can enable ExecCGI by going to your .htaccess and adding this line to the file: Options...

How to Fix WHM/cPanel Temp URL 404 or Not Supported Error?

You can use the cPanel's temporary URL to verify your website before publishing it live. However,...

What are the differecnce between Sub-Domain, Parked Domain And An Add-on Domain?

SubDomain You can add additional sections to your main domain as a sub-domain. This will help to...

  • 0 Users Found This Useful

Was this answer helpful?