sshd: fatal: Access denied for user foo by PAM account configuration [preauth]

Symptoms:

  • cannot log in over ssh as user foo (not even using publickey!)
  • a valid entry for foo exists in /etc/passwd
  • entries in /var/log/auth.log:

Oct 13 06:27:07 dl sshd[44354]: fatal: Access denied for user foo by PAM account configuration [preauth]

Solution:

  • Check /etc/shadow contains entries for the user in question.
  • Check syntax, too!

If an entry is missing, you can create a new one using the passwd utility.

Alternatively, if no password is required, create a dummy entry like this:

foo:!:15991:0:99999:7:::

For more info:

man 5 shadow