
我正在嘗試使用 useradd 建立一個新用戶(可以存取電子郵件)。我的命令是
useradd --shell /bin/bash --create-home --password <password> <username>
但是,我無法登入電子郵件。當我使用adduser
建立帳戶時,我可以正常登入郵件。
我正在建立一個主目錄,因為我dovecot.conf
有mail_location = mbox:~/mail:INBOX=/var/mail/%u
我的mail.err
文件只是重複了這個
Feb 21 15:52:46 server dovecot: auth-worker(3609): Error: pam(test,<myip>):
pam_authenticate() failed: Authentication failure
如何使用 useradd 連線到電子郵件 (imap)? (或至少一行)
答案1
此錯誤訊息:
Feb 21 15:52:46 server dovecot: auth-worker(3609): Error: pam(test,<myip>): pam_authenticate() failed: Authentication failure
可能由多種原因引起,例如:
- 用戶不存在
- 密碼錯誤
根據以上useradd
命令
useradd --shell /bin/bash --create-home --password <password> <username>
我懷疑你犯了以下錯誤:useradd 不會加密 /etc/shadow 中的密碼。上面的命令將把明文密碼進入/etc/shadow
。並且由於 PAM 期望 /etc/shadow 具有加密密碼,而您卻擁有明文密碼,因此身份驗證將會失敗。