Resetting email account password from Command line in cPanel

Hello Friends,

I hope my post stating the steps for resetting cPanel password from command line has been useful to you. Now let us see how to reset the Email account password from Command line.

Let us assume the following which make easy for me explain the steps in generalized manner.
~~~
The domain be : smsrinath.com
cpanel username be : sms
email account be : test@smsrinath.com
~~~

Now I am going to change the email account password for “test@smsrinath.com” from command line:

1) Login to the server as root via SSH

2) Run the command “openssl” and you will see this:
sms@test [~]# openssl
OpenSSL>

3) Now in the OpenSSL prompt give the command : passwd -1 “your_new_email_password”
sms@test [~]# openssl
OpenSSL> passwd -1 “smsrinath”
$1$mpq91w/j$1KYIVwHl8Ch9H6ScTFNWy/
OpenSSL> quit

Please note the option in command : passwd -1 “smsrinath”. It is not alphabet “-l”. It is numeric “-1”.
You will get the MD5 encrypted format for your password. Copy it somewhere.

4) Now you need to go to cpanel account’s home directory and then into etc folder.
sms@test [~]# cd /home/sms/etc/smsrinath.com
sms@test [/home/sms/etc/smsrinath.com]#

5) There you will be seeing some files : passwd, passwd,v , quota, quota,v , shadow, shadow,v .
Here the file we should consider is shadow and shadow,v.

6) If you check out shadow folder, you will see
sms@test [/home/sms/etc/smsrinath.com]# cat shadow
test:$6$itlQRN/bGoiCB/n/$53X3P/wy.lsS6u4u7vporiAqKBnfsF8Zx8b6MXs6/oxM0inzns3lsDfHdXNygq3pPOFR57ryWHk63A7JJr2r61:16673::::::

Please note that the  blue coloured part is the password part. You need to replace it with the MD5 format of your new password which you copied from OpenSSL prompt earlier.

test:$1$mpq91w/j$1KYIVwHl8Ch9H6ScTFNWy/:16673::::::

Save and close the file.

7) Now one more file to edit. shadow,v. In this file, you will some extended version of shadow file. Here you need to look for the part
sms@test [/home/sms/etc/smsrinath.com]# cat shadow,v
.
.
1.4
log
@”Modified by /usr/local/cpanel/cpanel “
@
text
@test:$6$itlQRN/bGoiCB/n/$53X3P/wy.lsS6u4u7vporiAqKBnfsF8Zx8b6MXs6/oxM0inzns3lsDfHdXNygq3pPOFR57ryWHk63A7JJr2r61:16673::::::
@
.
.

The same part you saw in shadow file. Replace the password part here as well with the MD5 part you copied earlier.
.
.
1.4
log
@”Modified by /usr/local/cpanel/cpanel “
@
text
@test:$1$mpq91w/j$1KYIVwHl8Ch9H6ScTFNWy/:16673::::::
@
.
.

Save and close the file.

8) All done. Now you can login to webmail of the email account with the new password.

I tried it and it worked perfectly. Eventhough there are no scripts provided by cPanel to change email account from command line, the above method can be used.

All izz Well !!   Have a Great Day !!!

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s