Hi,
In this post, I will show you how to change the password of a cPanel account.
You must be thinking that changing cPanel’s password is not a big task. Yes, you are correct.
Whenever we change the password of a cPanel user, password of default FTP, mail and MySQL change.
However when we want to change the password of cPanel user only, how can we do this? This is the main purpose of writing this post.
I will show you how to change the password of cPanel without affecting the password of default FTP mail and MySQL account associated with it. Please note that this can be achieved through command line.
First I will show you how to reset the cPanel password of a cPanel account from command line (that we generally do from cPanel or WHM). In this case, password of default FTP, mail and MySQL changes along with the password of cPanel username.
Suppose we have a cPanel username called “shekhar”, to change the password, execute the below command:
# passwd shekhar
If you execute the above command, you will asked to give the new password for your cPanel account “shekhar”.
Once you change the password, it will show message like “The system has updated the passwords for the following services: MySQL, ftp, mail, system”.
Here we see that the password of MySQL, ftp, mail, system changes. This is same as what we do this from WHM.
Command Line:
WHM:
Coming to the main topic, to change the password of cPanel user only, execute the below command:
The syntax is:
# /scripts/chpass <cPanel Username> <Your New Password>
Example:
# /scripts/chpass shekhar V5JwHVEA
When you execute the above command, you will get below warning:
========
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,
and WebDAV. 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
‘ALLOW_PASSWORD_CHANGE=1’.
========
Here we have to enable the allow password change option, by exporting it. execute the below command:
# export ALLOW_PASSWORD_CHANGE=1
Then run the cPanel chpass script with the cPanel account name and new password:
# /scripts/chpass shekhar V5JwHVEA
That’s all. You have now changed the password of your cPanel user ‘shekhar’ only. Password for default FTP, default mail, MySQL will remain the same (what was set earlier).
If you have any query regarding this post, feel free to comment in the below comment box.
Thank you. 🙂
My name is Shashank Shekhar. I am a DevOps Engineer, currently working in one of the best companies in India. I am having around 5 years of experience in Linux Server Administration and DevOps tools.
I love to work in Linux environment & love learning new things.
Powered by Facebook Comments
Hi Shekhar,
Can you please explain what happens when we export that variable and where did it come from (eg, cpanel config file ?)…?. It would have been better for beginners to understand.
Thank you
Hi,
Thank you for your question.
I am a bit confused about your query. Can you please explain me what do you want to say for “when we export that variable and where did it come from (eg, cpanel config file ?)”?
Please explain me so that I can help you with your question.