Centos

Sendmail chdir (/clientmqueue) 權限被拒絕

  • February 19, 2020

我的 centos 伺服器可以使用“郵件”命令發送郵件,但不能從 php 發送郵件。郵件日誌 說:

sendmail[18010]: NOQUEUE: SYSERR(nginx): can not chdir(/var/spool/clientmqueue/): Permission denied

我的權限如下:

lrwxrwxrwx 1 nginx nginx 30 Oct 30 20:27 /usr/lib/sendmail -> /etc/alternatives/mta-sendmail 
lrwxrwxrwx 1 nginx nginx 21 Oct 30 20:27 /usr/sbin/sendmail -> /etc/alternatives/mta

lrwxrwxrwx 1 nginx nginx 27 Oct 30  2012 /etc/alternatives/mta -> /usr/sbin/sendmail.sendmail
lrwxrwxrwx 1 nginx nginx 26 Oct 30  2012 /etc/alternatives/mta-sendmail -> /usr/lib/sendmail.sendmail

lrwxrwxrwx 1 nginx nginx     16 Oct 30  2012 /usr/lib/sendmail.sendmail -> ../sbin/sendmail
-rwxr-xr-x 1 root  smmsp 775064 Aug 11  2011 /usr/sbin/sendmail.sendmail

所有這些連結的用途是什麼?

Sendmail-8.12+安裝:文件權限

Sendmail-8.12+ 二進製文件應安裝為設置的GROUP id。

(/usr/sbin/sendmail.sendmail 在你的情況下)

SECURITY在 sendmail(.org) 分發中的文件中有描述:

-r-xr-sr-x  root   smmsp    ... /PATH/TO/sendmail
drwxrwx---  smmsp  smmsp    ... /var/spool/clientmqueue

還有一個名為 httpd_can_sendmail 的 SELINUX 布爾策略……我很確定這也必須設置為 true。

引用自:https://serverfault.com/questions/520531