权限相关问题 dovecot postfix
permission related issues dovecot postfix
在我尝试重建邮件服务器后,dovecot 错误和警告日志中出现以下错误消息。
在出现这些错误之前,我将老化的系统更新到最新版本,但很多东西都坏了。配置是五彩纸屑,所以我试图重建邮件服务器。要得到这个错误,我只需登录到 Roundcube 邮件。我可以登录,但是我看不到任何电子邮件。
我在错误中发现了两个问题,只是不确定如何解决。
Feb 06 18:07:15 imap(brad@nostalgicmail.com)<96785><ZgOYWl3XtMwX/pCT>: Error: chdir(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com/) failed: Permission denied (euid=150(<unknown>) egid=8(mail) missing +x perm: /var/vmail/nostalgicmail.com, dir owned by 2000:2000 mode=0700)
Feb 06 18:07:15 imap(brad@nostalgicmail.com)<96785><ZgOYWl3XtMwX/pCT>: Error: stat(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com/subscriptions) failed: Permission denied
问题 1:chdir(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com/)
这不是正确的目录,应该是/var/vmail/nostalgicmail.com/brad
问题 2:权限被拒绝 (euid=150() egid=8(mail) missing +x perm: /var/vmail/nostalgicmail.com, dir owned by 2000:2000 mode=0700)
问题 1 更正后可能会解决此问题。
我还有其他工作要做以完成服务器,例如确保所有 SSL 密钥正确、重新集成 sieve & spamassassin、dkim、spf 等。现在,我只需要电子邮件服务器正常运行。
我的目录设置如下所示:
zion@hwsrv-890039:~$ sudo ls -Al /var/vmail/
total 16
drwx------ 5 vmail vmail 4096 Sep 10 19:06 kingmobiletransport.com
drwx------ 11 vmail vmail 4096 Jan 20 18:49 nostalgicmail.com
drwx------ 3 vmail vmail 4096 Aug 15 05:28 sites-by-brad.com
drwx------ 2 vmail vmail 4096 Feb 5 20:26 spamassassin
zion@hwsrv-890039:~$ sudo ls -Al /var/vmail/nostalgicmail.com/
total 36
drwx------ 4 vmail vmail 4096 Jan 10 19:47 brad
drwx------ 3 vmail vmail 4096 Jan 10 03:59 chronicle
drwx------ 3 vmail vmail 4096 Jul 22 2021 dirtywill
drwx------ 3 vmail vmail 4096 Jul 6 2021 emerald
drwx------ 3 vmail vmail 4096 Jul 6 2021 mickey
drwx------ 3 vmail vmail 4096 Jul 9 2021 mistyblue
drwx------ 4 vmail vmail 4096 Sep 21 20:54 mquin007
drwx------ 3 vmail vmail 4096 Jan 20 18:49 tribeofriche
drwx------ 3 vmail vmail 4096 Jul 29 2021 weather
zion@hwsrv-890039:~$ sudo ls -Al /var/vmail/nostalgicmail.com/brad/
total 12
lrwxrwxrwx 1 vmail vmail 21 Jul 9 2021 .dovecot.sieve -> sieve/roundcube.sieve
-rw------- 1 vmail vmail 726 Jan 10 19:47 .dovecot.svbin
drwx------ 22 vmail vmail 4096 Feb 5 21:57 Maildir
drwx------ 3 vmail vmail 4096 Jan 10 19:35 sieve
zion@hwsrv-890039:~$
Dovecot 配置如下所示:
zion@hwsrv-890039:~$ sudo doveconf -n > dovecot_config
zion@hwsrv-890039:~$ cat dovecot_config
# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-11-cloud-amd64 x86_64 Debian 11.2 ext4
# Hostname: hwsrv-890039.nostalgicmail.com
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = plain
debug_log_path = /var/log/dovecot_debug.log
first_valid_uid = 100
info_log_path = /var/log/dovecot_info.log
log_path = /var/log/dovecot_error_warnings.log
mail_gid = mail
mail_location = maildir:/var/vmail/%d/%u
mail_privileged_group = mail
mail_uid = vmail
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 =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
postmaster_address = postmaster@nostalgicmail.com
protocols = " imap lmtp"
service auth-worker {
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service lmtp {
unix_listener lmtp {
group = postfix
mode = 0666
user = postfix
}
}
ssl_cert = </etc/letsencrypt/live/nostalgicmail.com/cert.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
verbose_ssl = yes
zion@hwsrv-890039:~$
后缀看起来像这样:
zion@hwsrv-890039:~$ sudo postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = localhost
myhostname = hwsrv-890039.nostalgicmail.com
mynetworks = 127.0.0.0/8
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
zion@hwsrv-890039:~$
@安德鲁·理查兹
谢谢!你的回复给了我很多继续下去的信息。
(对于面临类似问题的其他人)
我首先发送 grep -rnw '/etc/dovecot' -e 'mail_location'
来查找 mail_location 的所有实例以在那里进行更改。重新启动 dovecot.service
从那里开始,我仍然有 Error: stat(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com)
个错误。我从文档中记得还有 SQL 查询也使用邮箱位置,所以我发送 grep -rnw '/etc/dovecot' -e '/var/vmail/%d/%u'
来查找它们。进行更正,然后重新启动 dovecot.service。
这清除了我的第一部分错误,但我仍然遇到权限问题。
Permission denied (euid=150(<unknown>) egid=8(mail) missing +x perm:
上面一行告诉我 UID 150 对我的系统来说是未知的,并且
dir owned by 2000:2000 mode=0700)
告诉我谁拥有该目录。
grep -rnw '/etc/dovecot' -e '150'
显示我的 SQL 字符串正在为我设置一个 UID,所以我将 150 更改为 2000,重新启动 dovecot,它起作用了!我仍然想知道用户 UID 2000 是什么,所以我使用了
grep -rnw '/etc/dovecot' -e '2000'
高兴地报告说 UID 2000 属于用户 vmail
您声明“这不是正确的目录,它应该是 /var/vmail/nostalgicmail.com/brad”。您的(帮助提供的)配置包含,
mail_location = maildir:/var/vmail/%d/%u
Dovecot 的 mail location variables 将 %u
呈现为 user@domain。将其更改为 %n
,“user@domain 中的用户部分”以使用您提到的路径。
你可能仍然会遇到第一个错误,这对我来说是关键部分,
...Permission denied (euid=150(<unknown>) egid=8(mail) missing +x perm: /var/vmail/nostalgicmail.com, dir owned by 2000:2000 mode=0700)
假设错误仍然存在,请在 /etc/passwd
中查找这些 UID 以查看涉及哪些用户名,然后查看它与您的配置有何关系,也许尤其是。与授权有关的部分。从那里您可能需要调整一项或多项 Dovecot 配置、身份验证/邮箱查找或目录所有权/权限。
在我尝试重建邮件服务器后,dovecot 错误和警告日志中出现以下错误消息。
在出现这些错误之前,我将老化的系统更新到最新版本,但很多东西都坏了。配置是五彩纸屑,所以我试图重建邮件服务器。要得到这个错误,我只需登录到 Roundcube 邮件。我可以登录,但是我看不到任何电子邮件。
我在错误中发现了两个问题,只是不确定如何解决。
Feb 06 18:07:15 imap(brad@nostalgicmail.com)<96785><ZgOYWl3XtMwX/pCT>: Error: chdir(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com/) failed: Permission denied (euid=150(<unknown>) egid=8(mail) missing +x perm: /var/vmail/nostalgicmail.com, dir owned by 2000:2000 mode=0700)
Feb 06 18:07:15 imap(brad@nostalgicmail.com)<96785><ZgOYWl3XtMwX/pCT>: Error: stat(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com/subscriptions) failed: Permission denied
问题 1:chdir(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com/)
这不是正确的目录,应该是/var/vmail/nostalgicmail.com/brad
问题 2:权限被拒绝 (euid=150() egid=8(mail) missing +x perm: /var/vmail/nostalgicmail.com, dir owned by 2000:2000 mode=0700)
问题 1 更正后可能会解决此问题。
我还有其他工作要做以完成服务器,例如确保所有 SSL 密钥正确、重新集成 sieve & spamassassin、dkim、spf 等。现在,我只需要电子邮件服务器正常运行。
我的目录设置如下所示:
zion@hwsrv-890039:~$ sudo ls -Al /var/vmail/
total 16
drwx------ 5 vmail vmail 4096 Sep 10 19:06 kingmobiletransport.com
drwx------ 11 vmail vmail 4096 Jan 20 18:49 nostalgicmail.com
drwx------ 3 vmail vmail 4096 Aug 15 05:28 sites-by-brad.com
drwx------ 2 vmail vmail 4096 Feb 5 20:26 spamassassin
zion@hwsrv-890039:~$ sudo ls -Al /var/vmail/nostalgicmail.com/
total 36
drwx------ 4 vmail vmail 4096 Jan 10 19:47 brad
drwx------ 3 vmail vmail 4096 Jan 10 03:59 chronicle
drwx------ 3 vmail vmail 4096 Jul 22 2021 dirtywill
drwx------ 3 vmail vmail 4096 Jul 6 2021 emerald
drwx------ 3 vmail vmail 4096 Jul 6 2021 mickey
drwx------ 3 vmail vmail 4096 Jul 9 2021 mistyblue
drwx------ 4 vmail vmail 4096 Sep 21 20:54 mquin007
drwx------ 3 vmail vmail 4096 Jan 20 18:49 tribeofriche
drwx------ 3 vmail vmail 4096 Jul 29 2021 weather
zion@hwsrv-890039:~$ sudo ls -Al /var/vmail/nostalgicmail.com/brad/
total 12
lrwxrwxrwx 1 vmail vmail 21 Jul 9 2021 .dovecot.sieve -> sieve/roundcube.sieve
-rw------- 1 vmail vmail 726 Jan 10 19:47 .dovecot.svbin
drwx------ 22 vmail vmail 4096 Feb 5 21:57 Maildir
drwx------ 3 vmail vmail 4096 Jan 10 19:35 sieve
zion@hwsrv-890039:~$
Dovecot 配置如下所示:
zion@hwsrv-890039:~$ sudo doveconf -n > dovecot_config
zion@hwsrv-890039:~$ cat dovecot_config
# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-11-cloud-amd64 x86_64 Debian 11.2 ext4
# Hostname: hwsrv-890039.nostalgicmail.com
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = plain
debug_log_path = /var/log/dovecot_debug.log
first_valid_uid = 100
info_log_path = /var/log/dovecot_info.log
log_path = /var/log/dovecot_error_warnings.log
mail_gid = mail
mail_location = maildir:/var/vmail/%d/%u
mail_privileged_group = mail
mail_uid = vmail
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 =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
postmaster_address = postmaster@nostalgicmail.com
protocols = " imap lmtp"
service auth-worker {
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service lmtp {
unix_listener lmtp {
group = postfix
mode = 0666
user = postfix
}
}
ssl_cert = </etc/letsencrypt/live/nostalgicmail.com/cert.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
verbose_ssl = yes
zion@hwsrv-890039:~$
后缀看起来像这样:
zion@hwsrv-890039:~$ sudo postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = localhost
myhostname = hwsrv-890039.nostalgicmail.com
mynetworks = 127.0.0.0/8
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
zion@hwsrv-890039:~$
@安德鲁·理查兹 谢谢!你的回复给了我很多继续下去的信息。
(对于面临类似问题的其他人)
我首先发送 grep -rnw '/etc/dovecot' -e 'mail_location'
来查找 mail_location 的所有实例以在那里进行更改。重新启动 dovecot.service
从那里开始,我仍然有 Error: stat(/var/vmail/nostalgicmail.com/brad@nostalgicmail.com)
个错误。我从文档中记得还有 SQL 查询也使用邮箱位置,所以我发送 grep -rnw '/etc/dovecot' -e '/var/vmail/%d/%u'
来查找它们。进行更正,然后重新启动 dovecot.service。
这清除了我的第一部分错误,但我仍然遇到权限问题。
Permission denied (euid=150(<unknown>) egid=8(mail) missing +x perm:
上面一行告诉我 UID 150 对我的系统来说是未知的,并且
dir owned by 2000:2000 mode=0700)
告诉我谁拥有该目录。
grep -rnw '/etc/dovecot' -e '150'
显示我的 SQL 字符串正在为我设置一个 UID,所以我将 150 更改为 2000,重新启动 dovecot,它起作用了!我仍然想知道用户 UID 2000 是什么,所以我使用了
grep -rnw '/etc/dovecot' -e '2000'
高兴地报告说 UID 2000 属于用户 vmail
您声明“这不是正确的目录,它应该是 /var/vmail/nostalgicmail.com/brad”。您的(帮助提供的)配置包含,
mail_location = maildir:/var/vmail/%d/%u
Dovecot 的 mail location variables 将 %u
呈现为 user@domain。将其更改为 %n
,“user@domain 中的用户部分”以使用您提到的路径。
你可能仍然会遇到第一个错误,这对我来说是关键部分,
...Permission denied (euid=150(<unknown>) egid=8(mail) missing +x perm: /var/vmail/nostalgicmail.com, dir owned by 2000:2000 mode=0700)
假设错误仍然存在,请在 /etc/passwd
中查找这些 UID 以查看涉及哪些用户名,然后查看它与您的配置有何关系,也许尤其是。与授权有关的部分。从那里您可能需要调整一项或多项 Dovecot 配置、身份验证/邮箱查找或目录所有权/权限。