0

I'm trying to create a new user (that can access email) with useradd. My command is

useradd --shell /bin/bash --create-home --password <password> <username>

However, I cannot login to email. When I use adduser to create an account, I can login to the mail just fine.

I am creating a home directory because my dovecot.conf has mail_location = mbox:~/mail:INBOX=/var/mail/%u

my mail.err file just has this repeated

Feb 21 15:52:46 server dovecot: auth-worker(3609): Error: pam(test,<myip>): 
pam_authenticate() failed: Authentication failure

How can I connect to the email (imap) with useradd? (or at least with one line)

masegaloeh
  • 17,978
  • 9
  • 56
  • 104

1 Answers1

2

This error message:

Feb 21 15:52:46 server dovecot: auth-worker(3609): Error: pam(test,<myip>): pam_authenticate() failed: Authentication failure

can be caused by several reasons such as:

  • User didn't exist
  • Incorrect password

Based on above useradd command

useradd --shell /bin/bash --create-home --password <password> <username>

I suspect that you fall to the following mistake: useradd not encrypting passwords in /etc/shadow. Above command will put the plaintext password into /etc/shadow. And because PAM expects that /etc/shadow has encrypted password and yet you have plaintext password, the authentication will fail.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104