我正在尝试设置邮件服务器! 一切似乎都没有问题(经过一段时间),但是当我尝试使用IMAP服务器读取邮件时:
4月18日17:38:48 sd-84941 dovecot:imap(dlp):错误:打开(/data/maildir/dlp/cur/1460993401.13028_0.sd-84941:2)失败:Permission denied(euid = 1000(michael )egid = 1000(michael)missing + r perm:/data/maildir/dlp/cur/1460993401.13028_0.sd-84941:2 ,,我们不在第8组(邮件),dir拥有0:8 mode = 0777)
邮件在maildir文件夹中,但由于权限,我无法读取它们…
-rw-rw —- 1 root root 2363 Apr 18 17:55 1460994924.16416_0.sd-84941
但是,如果chmod 777它工作(但我不能每次都手工做这个):
-rwxrwxrwx 1 root root 2363 Apr 18 17:55 1460994924.16416_0.sd-84941:2,
发生了什么 ? 谁给文件许可? fetchmail,procmail或dovecot?
—–编辑——
感谢您的回答,@tripleee。 我会试着提供细节:
我已经安装了sendmail,procmail,fetchmail,dovecot和roundcube:
Sendmail&Roundcube:默认安装。
Procmail:
在/ etc / procmailrc(我更喜欢全局的conf和用户的方式),我们有:
MAILDIR=/data/mails/ DEFAULT=$MAILDIR/ LOGFILE=/var/log/procmail VERBOSE=on
在/ etc / fetchmailrc中:
set syslog set daemon 120 poll mail.interpc.fr with nodns, with protocol POP3, user "dlp", with password mypass option keep
我创build了一个vmail用户:
sudo addgroup --gid 5000 vmail sudo adduser --home /data/mails/ --uid 5000 --gid 5000 --shell /bin/false vmail
在/ etc / dovecot / users(使用vmail的uid&gid):
dlp:{PLAIN}mypass:5000:5000::
在/etc/dovecot/conf.d/10-auth.conf中,我已经更改为:
disable_plaintext_auth = no #!include auth-system.conf.ext !include auth-passwdfile.conf.ext
在/etc/dovecot/conf.d/10-mail.conf中:mail_location = maildir:/ data / mails /
root @ sd-84941:/ home / michael#ls -al / data / mails / cur /
共48个
drwxr - r - 2 vmail vmail 4096 Apr 21 15:08。
drwxr - r-- 5 vmail vmail 4096 Apr 21 15:08
-rwxr - r-- 1 root root 29635 Apr 21 13:31 1461238276.4519_0.sd-84941:2,
- rwxr - r-- 1 root root 3740 Apr 21 13:45 1461239150.5706_0.sd-84941:2,
-rw-r - r - 1 root root 2953 Apr 21 15:04 1461243887.17704_0.sd-84941:2,
谢谢你帮我…
现在你的软件组合有点不同寻常(比如10年到20年前的标准)。 我猜你正在做什么是使用fetchmail连接到POP服务器,然后它将邮件传递到procmail将邮件传递到本地目录。 这种方法已经变得不寻常,部分原因是现在支持POP的服务器并不多,而且IMAP允许在交付后在服务器之间移动邮件的更好的select。 如果有在上游服务器上使用IMAP的选项,请查看imapfilter 。 现在想要运行无法接受直接传送的邮件服务器也是不寻常的,这将允许您在上游服务器上设置邮件转发规则。
你大概会遇到问题,因为你正在使用procmail直接传递到本地目录,并且以procmail进程作为root运行,这不是dovecot运行的,所以dovecot不能读取这些文件。
你可以想出如何以正确的用户身份运行procmail,或者(如果以root身份运行)如何告诉它存储具有正确所有权的文件。 您可能会获得一定程度的兼容性,但是例如,dovecot不会在到达时正确编制电子邮件索引,因此search将会受到影响。
我build议您使用dovecot作为本地交付代理交付。 它可能会取代procmail,或者可能被procmail 1,2调用。 无论哪种情况,您都需要使用适当的参数( -d )来调用它,以识别您要传递给的用户。 如果您使用procmail来决定要传递哪个邮件文件夹,您可能需要使用-p参数,或者使用dovecot的筛选筛选引擎来做出这些决定可能会更好。 在处理系统用户而不是虚拟用户时,procmail真的是最好的。
Sieve是一个比procmail更好的为虚拟用户devise的解决scheme,虽然这是一个开放性的问题,它有一个不太愉快的filter语法。 我从procmail那里得到了很多好的服务,而且我现在使用了一些筛选器,因为它在交付之前就行了,但是在交付之后在服务器之间传递邮件,以及在情况允许的情况下,我更愿意使用imapfilter编写filter。