Linux : Email accounts vanished from cPanel

By | April 28, 2024

If all of a sudden, all your email accounts in your cPanel vanished for no reason, here is what

Look to see if the email account data is still present under the following path :

/home/$user/mail/$domain

And see if there are folders corresponding to the email account name (folders will be named with whatever preceed @domain.tld)

If you see the folders corresponding to the various email account you had, then it is most likely that either the “shadow” file or “passwd” file are corrupted, empty or missing.

Look to see if the following files exists, are readable and contiain the email user account information you had :

/home/$user/etc/$domain/shadow
/home/$user/etc/$domain/passwd

If they do not exist, contain no information or cannot be read (check permissions – they should have the account name/group and 640 permissions).  If your issue correspond to the two first statements, you will need a restore from backups.

After fixing the issue as proposed depending your situation, if the email accounts are still not shown in cPanel, this is most likely due to a caching issue.  To resolved that, you will need SSH access and rename the following folder as followed :

mv /home/$user/.cpanel /home/$user/.cpanel.bak

The account should now appear in cPanel.  If everything went well, you can get rid of the “.cpanel.bak” folder as followed :

rm -Rf /home/$user/.cpanel.bak