dovecot: auth: Error: Cpanel::MailAuth: Failed to getpwnam

cpanel-email-authentication-failed

If you are not able to access email even with correct username and password and you see below error in the /var/log/maillog

Jul  5 18:15:20 hostname dovecot: auth: Error: Cpanel::MailAuth: Failed to getpwnam for user webmaster
Jul  5 18:15:38 hostname dovecot: auth: Error: Cpanel::MailAuth: Login not permitted to account with a uid lower then 500 (498)
Jul  5 18:15:56 hostname dovecot: auth: Error: Cpanel::MailAuth: Failed to getpwnam for user admin
Jul  5 18:54:38 hostname dovecot: auth: Error: Cpanel::MailAuth: Failed to getpwnam for user info
Jul  5 18:54:45 hostname dovecot: auth: Error: Cpanel::MailAuth: Failed to getpwnam for user info
Jul  5 18:55:06 hostname dovecot: auth: Error: Cpanel::MailAuth: Failed to getpwnam for user info

Reason:

This happens if hostname is same as domain. The mail server will try to authenticate against system user of the server instead of virtual domains on the server.

Solution:

Change the hostname of the server to something else other than domain name. e.g. if your domain is domain.com then you can set the hostname as host.domain.com

Also make sure that there is entry of the domain in both /etc/localdomains and /etc/userdomains.

 

About 

Sreejit is the founder of Server Management Plus. His motto is "If there's an easier way, Why do it any other way" and following it, he has created a lots of automation scripts for the company using which we are able to resolve issue at an extremely fast rate and save lots of time. He has a very keen interest in new technologies and spend most of his free time online researching about it apart from listening music and watching movies.