Symptoms
Under the Email Accounts interface in cPanel, the list of email accounts displayed may need to be included for an entire domain, or only a single or a few addresses will show.
Furthermore, any attempts to recreate the missing accounts result in an error stating the accounts already exists.
Description
If a domain's passwd file is modified or damaged, it can result in email accounts not showing in the cPanel interface and cause authentication errors for the email users.
Restoring a backup of the shadow and passwd files is the only way to restore the domain's previous passwords.
Workaround
Please note that "$user" is the cPanel account in the below commands, and "domain.tld" is the domain you're working with.
A backup of the damaged file can be restored to restore the email account list and passwords. Relevant files are found inside a cPanel backup under the following paths:
$user/homedir/etc/domain.tld/passwd
$user/homedir/etc/domain.tld/shadow
Extract the passwd and shadow files from a cPanel backup file
tar -xf $user.tar.gz $user/homedir/etc
This extracts all domain's passwd and shadow files into the current working directory, in the $user/homedir/etc folder.
Move the files you're replacing to another directory to back them up. In this example, I am creating a backup folder in /root to use:
mkdir /root/backup
mv -v /home/$user/etc/domain.tld/{shadow,passwd} /root/backup/
Now you can copy the backed-up files into the domain's etc folder:
cp -v $user/homedir/etc/domain.tld/{shadow,passwd} /home/sean/etc/domain.tld/
cPanel's email account cache needs to be moved aside now to the /root/backup directory we created earlier:
mv -v /home/$user/.cpanel/email_accounts_count /home/$user/.cpanel/email_accounts.json /root/backup
Lastly, the Dovecot authentication cache must be cleared to force users to use the new passwords.
doveadm auth cache flush
Comments
0 comments
Article is closed for comments.