Cod*_*Med 5 email centos postfix dovecot
我使用本教程设置Postfix和Dovecot一个在CentOS 7Web服务器。但是,当我尝试使用 发送测试电子邮件时sudo echo "TEST" | mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog,我收到一条错误消息,指出 Dovecot 无权创建用于存储电子邮件的目录。我如何设置权限Dovecot并Postfix使其能够正常工作CentOS 7?
我是新手linux。我知道adduser,chmod,chown,octal permissions,等命令,但我不知道它们是如何适用于这个特定的要求,我不想被不理解尝试创建无效的东西。
这是错误消息中最相关的部分:
Error: user import: Initialization failed: Namespace '':
mkdir(/home/import/Maildir) failed:
Permission denied (euid=1001(import) egid=1001(import)
missing +w perm: /home/import, UNIX perms appear ok (ACL/MAC wrong?))
Run Code Online (Sandbox Code Playgroud)
这是完整的错误消息:
Dec 30 19:03:42 mydomain postfix/pickup[8093]: A22E78221C13: uid=1000 from=<anotherusername>
Dec 30 19:03:42 mydomain postfix/cleanup[8121]: A22E78221C13: message-id=<20141231000342.A22E78221C13@mydomain.com>
Dec 30 19:03:42 mydomain postfix/qmgr[8094]: A22E78221C13: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, dir owned by 0:0 mode=0755)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 19:03:42 mydomain postfix/local[8123]: A22E78221C13: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.06/0.02/0/0.07, dsn=4.3.0, status=deferred (temporary failure)
Run Code Online (Sandbox Code Playgroud)
编辑:
然后我跑了sudo chown -R newusername:newusername /home/newusername然后再次重复,sudo echo "TEST" | sudo mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog但仍然出现以下错误:
Dec 30 20:42:29 mydomain postfix/qmgr[8094]: E0DF28221C14: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:42:29 mydomain postfix/local[8531]: E0DF28221C14: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=1101, delays=1101/0.02/0/0.06, dsn=4.3.0, status=deferred (temporary failure)
Dec 30 20:45:40 mydomain postfix/pickup[8529]: CF3CB80B33C4: uid=0 from=<root>
Dec 30 20:45:40 mydomain postfix/cleanup[8551]: CF3CB80B33C4: message-id=<20141231014540.CF3CB80B33C4@mydomain.com>
Dec 30 20:45:40 mydomain postfix/qmgr[8094]: CF3CB80B33C4: from=<root@mydomain.com>, size=455, nrcpt=1 (queue active)
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:45:40 mydomain postfix/local[8553]: CF3CB80B33C4: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.08/0.02/0/0.05, dsn=4.3.0, status=deferred (temporary failure)
Run Code Online (Sandbox Code Playgroud)
回答:
这个问题是由 SELinux 引起的。我通过sudo nano /etc/sysconfig/selinux然后设置解决了这个问题SELINUX=disabled。这在开发过程中是可以接受的。一个更完整的解决方案是设置一个 SELinux 规则,允许 postfix 和 dovecot 在投入生产之前运行。
注意:七百四十二条建议我检查 SELinux 状态,所以我将他标记为正确答案。
关键在这里:failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, dir owned by 0:0 mode=0755
Dovecot 尝试写入/home/newusername/{whatever your maildir is}newusername:newusername,但是该目录由用户 0:0(root)拥有。因为权限模式是755,所以只有所有者才有+w权限
另外,如果您使用 SELinux,请确保您的 ACL 允许 dovecot 写入您的 maildir
| 归档时间: |
|
| 查看次数: |
4032 次 |
| 最近记录: |