Changing FTP password of all accounts in a cPanel server.

Changing FTP password of all accounts in a cPanel server.

Here is a cPanel script [chpass] to reset each user’s password. Its syntax is as follows


After running the script always run the following script


Using the above cPanel script I have created my own script to change all users password in one shot.


cat /etc/trueuserdomains | sort -t” ” -k2 > LIST.txt
exec 7 LIST.txt
for i in `cat /etc/trueuserdomains | awk ‘{ print $2 }’ | sort`; do
read > pass
sleep 1


What actually this script is doing?

01. Makes a sorted list of ‘/etc/trueuserdomains’ [sort with usernames] in a file ‘LIST.txt’
02. A File Descriptor opened for ‘LIST.txt’
03. Opened a for loop to itarate each users in ‘/etc/trueuserdomains’
04. Read the first line in the FD and remove the same on each iteration
05. Store a date format in a variable for generating password
06. Store a part of user name, say from third character of the name to last character, in variable for complicating the generated password
07. Executing the cPanel password changing script with appropriate parameters
08. Outing the information [Domain Name, User Name and New Password] to a file named “pass” on each iteration
09. Making a delay of 1 second on each iteration
10. Ending the for loop
11. Running cPanel password synchronization script.


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