![Debian sendmail 无法写入](https://linux22.com/image/1396222/Debian%20sendmail%20%E6%97%A0%E6%B3%95%E5%86%99%E5%85%A5.png)
我的 Debian 服务器上有一个可以正常工作的 sendmail 配置,我尝试放置一个 postfix 来接收电子邮件,但是放弃了,删除了 postfix,重新安装了 sendmail,但是什么都不起作用了 :(
这是我的 mail.log
Feb 2 12:35:56 sd-42311 sendmail[14881]: s12BZuYe014881: from=root, size=69, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Feb 2 12:35:56 sd-42311 sm-mta[14882]: s12BZuRw014882: SYSERR(root): collect: Cannot write ./dfs12BZuRw014882 (bfcommit, uid=0, gid=113): No such file or directory
Feb 2 12:35:57 sd-42311 sm-mta[14882]: s12BZuRw014882: from=<[email protected]>, size=336, class=0, nrcpts=1, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Feb 2 12:35:57 sd-42311 sendmail[14881]: s12BZuYe014881: [email protected], ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30069, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dfs12BZuRw014882 (bfcommit, uid=0, gid=113): No such file or directory
我已经对 superuser/stackoverflow 和其他进行了一些研究,这是我的 var/spool/,我尝试了几个所有者/chmod,但都没有用
drwxr-xr-x 5 root root 4096 nov. 12 21:13 cron
lrwxrwxrwx 1 root root 7 févr. 1 21:54 mail -> ../mail
drwxr-xr-x 2 root root 4096 janv. 5 19:14 mlmmj
drwxrwsrwt 2 root smmsp 4096 févr. 11 2013 mqueue
drwxrws--- 2 root smmsp 12288 févr. 2 13:40 mqueue-client
drwxr-xr-x 2 root root 4096 mars 5 2013 rsyslog
我认为我的 postfix 已被完全删除,并且没有 postfix 守护进程正在运行。
aptitude remove postfix --purge
有人能帮我解决我的问题吗?谢谢 :)
答案1
有时,即使您已删除 sendmail,sendmail 进程仍拒绝终止,这可能会导致此类问题。
对于你的情况,只需看看你是否有一个现有的 sendmail 进程
$ sudo service sendmail stop
$ ps auxwww | grep sendmail
如果找到一个,请将其终止,然后“没有这样的文件..”错误就会消失。
答案2
如果文件/目录权限太宽泛,Sendmail 将拒绝工作出于安全原因如下所述DontBlameSendmail
文档。[DontBlameSendmail
是最后的解决办法。]
您对队列目录(mqueue)的“全球可写”权限不安全。
安全分发中的文件sendmail
建议:
drwx ------ root wheel ... /var/spool/mqueue
答案3
我遵循了 DontBlameSendmail 和安全文件的说明。
命令
sendmail -v -d44.4 -bv postmaster
给我吗
safefile(/etc/mail/sendmail.cf, uid=0, gid=0, flags=6000, mode=400):
safedirpath(/etc/mail, uid=0, gid=0, flags=6000, level=0, offset=0):
[dir /etc/mail] OK
[uid 0, nlink 1, stat 100444, mode 400] OK
safefile(/etc/mail/local-host-names, uid=0, gid=0, flags=6580, mode=400):
safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
[dir /etc/mail] OK
[uid 0, nlink 1, stat 100644, mode 400] OK
safefile(/etc/mail/relay-domains, uid=0, gid=0, flags=6580, mode=400):
safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
[dir /etc/mail] OK
[uid 0, nlink 1, stat 100644, mode 400] OK
safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
[dir /etc/mail] OK
[uid 0, nlink 1, stat 100644, mode 400] OK
safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
[dir /etc/mail] OK
[uid 0, nlink 1, stat 100644, mode 400] OK
safedirpath(/var/spool/mqueue, uid=0, gid=0, flags=4, level=0, offset=0):
[dir /var/spool/mqueue] OK
safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
[dir /etc/mail] OK
[uid 0, nlink 1, stat 100644, mode 400] OK
safefile(/etc/mail/aliases.db, uid=0, gid=0, flags=584, mode=400):
safedirpath(/etc/mail, uid=0, gid=0, flags=584, level=0, offset=0):
[dir /etc/mail] OK
[uid 110, nlink 1, stat 100640, mode 400] OK
postmaster... aliased to root
root... aliased to hackstrong
safedirpath(/home/hackstrong, uid=1000, gid=1000, flags=1985, level=0, offset=0):
[dir /home/hackstrong] OK
safefile(/home/hackstrong/.forward.sd-42311, uid=1000, gid=1000, flags=1895, mode=400):
[uid 0, nlink 1, stat 100644, mode 4] OK
hackstrong... deliverable: mailer local, user hackstrong
我没有看到任何错误?
我还修改了 sendmail 的权限,但我不确定“wheel”用户组是什么?:
变量/spool/
drwxr-xr-x 5 root root 4096 nov. 12 21:13 cron
lrwxrwxrwx 1 root root 7 févr. 1 21:54 mail -> ../mail
drwxr-xr-x 2 root root 4096 janv. 5 19:14 mlmmj
drwx------ 2 root smmsp 4096 févr. 11 2013 mqueue
drwxrwx--- 2 smmsp smmsp 20480 févr. 3 10:05 mqueue-client
drwxr-xr-x 2 root root 4096 mars 5 2013 rsyslog
usr/sbin/sendmail -> /usr/lib/sm.bin/sendmail
-r-xr-sr-x 1 root smmsp 868256 févr. 11 2013 sendmail
等/邮件
-r--r--r-- 1 root smmsp 64486 févr. 2 11:42 sendmail.cf
-r--r--r-- 1 root smmsp 44006 févr. 2 11:42 submit.cf
我的 mail.log 文件中仍然有同样的错误:(