Is there any option/scripts to change the cPanel email account’s password from command line

Is any option/scripts to change the cPanel email account’s password from command line

I believe, there isn’t any direct method or scripts to change the cPanel email account’s password from command line. The password for cPanel email account’s is saved in the shadow file under the directory “etc” under user home location.

There is a directory as same as that of your domain.com which has all information about the email accounts created under that account.
Sample path to e-mail authentication directory.

/home/$user-name/etc/domain.com

Folder contents

drwxr-xr-x 2 user-name user-name 4096 Jan 14 14:04 mailaccount1/
-rw-r----- 1 user-name mail 193 Jan 14 14:10 passwd
-rw-r----- 1 user-name mail 1144 Sep 14 08:14 passwd,v
drwxr-x--- 2 user-name user-name 4096 Dec 25 12:49 \@pwcache/
-rw-r----- 1 user-name mail 30 Dec 25 12:49 quota
-rw-r----- 1 user-name mail 988 Sep 14 08:14 quota,v
-rw-r----- 1 user-name user-name 372 Jan 14 14:10 shadow
-rw-r----- 1 user-name user-name 1589 Sep 14 08:14 shadow,v
drwxr-xr-x 2 user-name user-name 4096 Jan 14 14:04 mailaccount2/

Here, mailaccount1 and mailaccount2 are the emailaccounts details under the domain.

1. The file “passwd

Example

# cat passwd
mailaccount1:x:598:611::/home/$user-name/mail/domain.com/mailaccount1:/home/user-name
mailaccount2:x:598:611::/home/$user-name/mail/domain.com/mailaccount2:/home/user-name

The passwd file has information such us:

Account name : mailaccount1
Password field : Represents ‘x’
GID UID : 598:611
The default directory path : /home/$user-name/mail/domain.com/mailaccount1

2. The file “shadow

Example

# cat shadow
mailaccount1:$6$oj6kY0S1.PrA9PXL$skMPeQ362XLBFqClx/knfNXRSH7ofVmEgtNtJ46MIbdJzI/fSn1Lm3yMxGqWH3Br0pUypBG432pVpcO6M/rWk/:15962::::::
mailaccount2:$6$4O.KUf8MW5vY93RE$Guuvdd.RVDIWDpnwAV3hSti0PzDXmlsGGCvocUyjf448U51lOB2ohUjJX/jQgb8kNzzYpSQb1HNKC5YsCFShu.:16064::::::

It is the file which is used to save the encripted passwords fpr email accounts.

3. The file “quota

Example

# cat quota
mailaccount1:262144000
mailaccount2:262144000

This file having the information regarding the email account’s quota.

Note that, there is a scripts to create email account via SSH.

How/Script to create Email account on your server through SSH?

/scripts/addpop [email protected] password quota#

[email protected] : e-mail account name.
password : Replace with account’s password.
quota# : email quota field.

Example

# /scripts/addpop [email protected] password
<br />
Created [email protected] with password password with a quota of unlimited for user $username.

How/Script to remove Email account on your server through SSH?

# /scripts/delpop [email protected]

Example

# /scripts/delpop [email protected]
<br />
<br />
<br />
Deleted [email protected] for user $username.

That’s it

Related
How to terminate/delete a cPanel account through SSH?
Important WHM/cPanel Scripts

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

2 thoughts on “Is there any option/scripts to change the cPanel email account’s password from command line

Leave a Reply

Your email address will not be published. Required fields are marked *