Dovecot不像我期望的那样使用mail_location
。
我想为LDAP目录中的用户提供电子邮件服务。 用户帐户是存储在LDAP中的虚拟帐户,并且不映射到本地用户。
OS Debian GNU/Linux 8.2 (jessie)
dovecot-core 1:2.2.13-12~deb8u1
dovecot-imapd 1:2.2.13-12~deb8u1
dovecot-ldap 1:2.2.13-12~deb8u1
squirrelmail 2:1.4.23~svn20120406-2
postfix 2.11.3-1
apache2 2.4.10-10+deb8u3
我设置了/etc/dovecot/conf.d/10-mail.conf
:
mail_location = maildir:/var/mail/vhosts/%d/%n
所以我希望邮件地址位于/var/mail/vhosts/mydomain.com/myuser
myuser@mydomain.com
。
dovecot -n
命令抛出的一些鸽舍设置是:
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
protocols = " imap lmtp sieve"
service auth-worker {
user = vmail
}
service imap-login {
inet_listener imap {
port = 143
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
userdb {
args = /etc/dovecot/dovecot-ldap.conf.ext
driver = ldap
}
使用/var/log/mail.log
命令查看tail -f
,它会抛出:
Sep 27 19:10:48 balam dovecot: imap-login: Login: user=<myuser>, method=PLAIN, rip=::1, lip=::1, mpid=24907, secured, session=<7/umVr8gvwAAAAAAAAAAAAAAAAAAAAAB>
Sep 27 19:10:48 balam dovecot: imap(myuser): Error: user myuser: Initialization failed: Namespace '': mkdir(/var/mail/vhosts//myuser) failed: Permission denied (euid=30000(myuser) egid=30002(IT) missing +w perm: /var/mail/vhosts/, dir owned by 5000:5000 mode=0755)
Sep 27 19:10:48 balam dovecot: imap(myuser): Error: Invalid user settings. Refer to server log for more information.
正试图在/var/mail/vhosts//myuser
创建邮件目录,而不是{I}我希望和期望的。{/ p>
如果您需要更多详情,请问我!
为了测试登录,我安装了一个SquirrelMail客户端,它触发了/var/mail/vhosts/mydomain.com/myuser
中记录的先前事件。
答案 0 :(得分:0)
您必须在配置中设置两个参数 - mail_uid
和mail_gid
。在未设置deliver
之前,执行数据库查找以获取收件人的UID和GID。如果有的话 - 它们将用于文件系统访问。邮件存储层次属于5000:5000
LDA无法在/var/mail/vhosts
内写入
只需添加可以访问邮件存储的用户的明确声明:
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_uid = 5000 # or his login name
mail_gid = 5000 # or his group name
并重新启动dovecot
。然后将使用UID / GID = 5000调用deliver
。此外,现在您可以将邮件存储权限设置为700,以防止除5000:5000以外的任何人访问邮件存储。