Pages

Wednesday, December 5, 2018

Resetting email account password from Command line in cPanel

1) Login to the server as root via SSH

2) Run the command “openssl” and you will see this:

    test@test [~]# openssl
    OpenSSL>

3) Now in the OpenSSL prompt give the command : passwd -1 “your_new_email_password”

    test@test [~]# openssl
    OpenSSL> passwd -1 “test@123”
    $1$m4pq941w/j$1KYI5VwHl8C6h9H6ScTFNWy/
    OpenSSL> quit

Please note the option in command: passwd -1 “test@123”. 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.

    test@test [~]# cd /home/test/etc/test.com
    test@test [/home/test/etc/test.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

    test@test [/home/test/etc/test.com]# cat shadow
    test:$6$itlQRsdN/bGoiCB/n/$53X3P/wy.lsS6uds4u7vporiAqdKBnfsF8Zx8b6MXs6/oxM0inzns3lsDfHdXNygq3pdPOFR57ryWHk63A7JJr2r61:15673::::::

Please note that the dark black colored 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$m4pq941w/j$1KYI5VwHl8C6h9H6ScTFNWy/:16673::::::

Save and close the file.

If shadow,v file is present then replace the encrypted part same as above. If a file is not present then try login to webmail it will work.

No comments:

Post a Comment