使用 ubuntu 服务器 (12.04) 上的 postfix,应该发送给 root 的电子邮件最终没有发送给任何人。为什么?我如何确保它被定向到实际帐户?
我的 /etc/aliases 文件如下所示:
# Mail aliases for sendmail
#
# You must run newaliases(1) after making changes to this file.
#
# Required aliases
postmaster: root
MAILER-DAEMON: postmaster
# Common aliases
abuse: postmaster
spam: postmaster
# Other aliases
admin: DrSAR
对我来说,这意味着发往postmaster
(不存在的用户)的邮件应被定向到root
。但邮件并没有到达那里。我可以看到邮件到达/var/spool/mail/nobody
。
我检查了一下,没有/root/.forward
文件。所以邮件也没有被手动重定向到任何人(或其他未知用户名)。
还有哪些设置会影响邮件的重定向?
一些诊断信息:
root@SERVER:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = $myhostname, localhost.localdomain, localhost.localdomain, localhost, $mydomain
mydomain = FQDN.SERVER.COM
myhostname = FQDN.SERVER.COM
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
以及发送到 root@localhost 的消息的一些日志输出
Jul 15 10:16:23 localhost postfix/smtpd[26006]: connect from localhost[127.0.0.1]
Jul 15 10:16:23 localhost postfix/smtpd[26006]: AE3AD3920547: client=localhost[127.0.0.1]
Jul 15 10:16:24 localhost postfix/smtpd[26006]: disconnect from localhost[127.0.0.1]
Jul 15 10:16:24 localhost postfix/pickup[20987]: 367A73900028: uid=1000 from=<[email protected]>
Jul 15 10:16:24 localhost postfix/cleanup[26008]: 367A73900028: message-id=<[email protected]>
Jul 15 10:16:24 localhost postfix/qmgr[20988]: 367A73900028: from=<[email protected]>, size=676, nrcpt=1 (queue active)
Jul 15 10:16:24 localhost postfix/local[26011]: 367A73900028: to=<[email protected]>, relay=local, delay=0.97, delays=0.86/0/0/0.11, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Jul 15 10:16:24 localhost postfix/qmgr[20988]: 367A73900028: removed
答案1
正如@gertvdijk 正确诊断的那样,这是使用procmail
MDA 的一个特性。(grox.net/doc/postfix/html/faq.html#root)
解决方案是添加从 root 到另一个用户的明确重定向,/etc/aliases
然后运行sudo newaliases
。