使用Apache+;发送邮件的权限出错;PHP而不将权限更改为777

使用Apache+;发送邮件的权限出错;PHP而不将权限更改为777,php,apache,sendmail,Php,Apache,Sendmail,除非我将/var/spool/clientmqueue的权限更改为777,否则我无法从apache+php使用sendmail /var/spool/clientmqueue的所有权 drwxrwxrwx 2 smmsp mail 4096 Jul 19 11:50 clientmqueue 我搞砸了smmsp和apache的用户组 id apache uid=48(apache) gid=48(apache) groups=48(apache),12(mail) id mail uid=1

除非我将/var/spool/clientmqueue的权限更改为777,否则我无法从apache+php使用sendmail

/var/spool/clientmqueue的所有权

drwxrwxrwx 2 smmsp mail 4096 Jul 19 11:50 clientmqueue
我搞砸了smmsp和apache的用户组

id apache
uid=48(apache) gid=48(apache) groups=48(apache),12(mail)

id mail
uid=12(mail) gid=12(mail) groups=12(mail),48(apache)
SELinux已禁用

getsebool httpd_can_sendmail
getsebool: SELinux is disabled
在邮件日志中,如果我将文件夹权限设置为770

NOQUEUE: SYSERR(apache): can not write to queue directory
/var/spool/clientmqueue/ (RunAsGid=48, required=12): Permission denied
没有邮件将被发送,我会从php得到一个错误

如果我将文件夹设置为0777,那么我将在邮件日志中获取该文件夹

dangerous permissions=40776 on queue directory /var/spool/clientmqueue/
但是php可以发送邮件

是否有可能让0770和apache在邮件组中读取时工作。我知道错误是获取apaches主GID 48,但它也共享第12组


任何帮助都会很棒。

我今天同样遇到了这个问题(来这里寻找答案)

我终于发现,;从该列表运行以下命令修复了我的问题:

chmod 4555 /usr/sbin/sendmail
这将在sendmail二进制文件上设置,可能允许Apache以邮件用户的身份发送邮件

(在运行apache和sendmail守护程序之后,我重新启动了它们,但我不确定哪一个确实需要重新启动)


我仍然很好奇到底是什么原因导致了这个问题,但是…

这一次对我起了作用。在Ubuntu机器上点击这个之前,我还有其他错误。让我分享一下,以防有人碰到他们。我正在 NOQUEUE:SYSERR(www-data):无法chdir(/var/spool/mqueue-client/):权限被拒绝

usermod -a -G smmsp www-data
chmod 770 /var/spool/mqueue-client     (don't use 775, it gives dangerous permission error in the log)
service apache2 restart (this is required for the above to take effect)
Now sending email gives a different error.
- NOQUEUE: SYSERR(www-data): can not write to queue directory /var/spool/mqueue-client/
- chmod 4555 /usr/sbin/sendmail
- Above command fixed the email issue. => didn't see any error in the mail.log this time.

先生,你救了我的命!谢谢