2012-03-14 93 views
3

我不能让sendmail工作从Apache + PHP,除非我更改/ var/spool/clientmqueue 777的权限。与权限发送邮件与Apache + PHP的权限错误,而没有更改权限777

所有权的/ var /阀芯/ 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 

在maillog的,如果我设置文件夹的权限,以770

NOQUEUE: SYSERR(apache): can not write to queue directory 
/var/spool/clientmqueue/ (RunAsGid=48, required=12): Permission denied 

没有邮件将被发送,我会从PHP得到一个错误。

如果我的文件夹设置为0777,然后代替我会得到这个在maillog中

dangerous permissions=40776 on queue directory /var/spool/clientmqueue/ 

但是PHP将发送邮件的罚款。

是否有可能得到它与0770和Apache正在阅读组邮件的工作。我知道错误是apaches主要GID 48,但它也共享组12.

任何帮助将是可怕的。

回答

1

我今天有同样的问题(并在这里寻找答案)。

我终于找到了this overview;运行从该列表下面的命令修复该问题对我来说:

chmod 4555 /usr/sbin/sendmail 

这台setuid special mode上sendmail程序,可能允许Apache发送邮件的邮件用户。

(我跑后重新启动两个apache和sendmail的守护进程,虽然我不能确定它的实际需要重启的)我

仍然非常好奇,什么在第一造成这个问题地方然而...

1

这一个为我做了诡计。在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.