这个问题来自一个与这个https://serverfault.com/questions/320607/ubuntu-jaunty-sendmail-php-mail-premission-errors非常相似的问题
但这些答案并不能解决我的问题
我有一个php应用程序,正在使用PHPMailer发送电子邮件。
我在我的ubuntu 12.04 LTS上安装了sendmail
sudo apt-get install sendmail
sudo sendmailconfig但该应用程序无法发送任何邮件。在mail.err中,它说:
Apr 14 00:31:42 AY sendmail[32241]: NOQUEUE: SYSERR(www-data): can not chdir(/var/spool/mqueue-client/): Permission denied而www-data是apache2的用户名。
然后我遵循了互联网上的一些指南,将www-data添加到smmsp组中:
sudo usermod -a -G smmsp www-data现在当我
groups www-data我得到了
www-data : www-data smmsp而/etc/group中的行是:
smmsp:x:114:www-data此外,我还确保可以访问/var/spool/mqueue-client/ is 770
/var/spool]$ ls -la
total 28
drwxr-xr-x 7 root root 4096 Apr 2 00:21 .
drwxr-xr-x 11 root root 4096 Apr 14 03:30 ..
drwxr-xr-x 5 root root 4096 Aug 6 2012 cron
lrwxrwxrwx 1 root root 7 Aug 6 2012 mail -> ../mail
drwxr-s--- 2 smmta smmsp 4096 Apr 14 06:25 mqueue
drwxrws--- 2 smmsp smmsp 4096 Apr 14 06:25 mqueue-client
drwxr-xr-x 2 root root 4096 Apr 13 2012 plymouth
drwxr-xr-x 2 syslog adm 4096 Mar 31 2012 rsyslog
/]$ ls -ld /var/spool/mqueue-client/ /usr/sbin/sendmail
lrwxrwxrwx 1 root root 26 Apr 2 00:21 /usr/sbin/sendmail -> /etc/alternatives/sendmail
drwxrws--- 2 smmsp smmsp 4096 Apr 14 06:25 /var/spool/mqueue-client/但是当我尝试发送邮件时,我仍然收到错误
Apr 14 03:26:57 AY sendmail[6131]: NOQUEUE: SYSERR(www-data): can not write to queue directory /var/spool/mqueue-client/ (RunAsGid=33, required=114): Permission denied33是www-data的gid
www-data:x:33:我应该怎么做才能让sendmail正常工作,同时又能保证安全性?此外,在生产环境中,sendmail的正确权限配置(用户、组和目录访问等)是什么?
发布于 2014-04-19 00:05:34
标准安装sendmail-8.12+需要将sendmail二进制文件安装为设置的组 id。
(/usr/sbin/sendmail -> ... -> /usr/lib/sm.bin/sendmail )
-rwxr-sr-x 1根smmsp...
如果是软链接链,请尝试:
chown root:smmsp /usr/lib/sm.bin/sendmail
chmod 2555 /usr/lib/sm.bin/sendmail建议的权限在sendmail分发的SECURITY文件中进行了说明。在我的debian上,这个文件被sendmail-doc包安装为/usr/share/doc/sendmail-doc/sendmail/SECURITY.gz。
发布于 2018-10-15 03:50:41
因此,如果您继承了一个系统,并且希望将/var/spool/mqueue的位置更改为其他位置,并且当您修改sendmail.mc并重新创建假脱机或编辑sendmail.cf目录时,启动sendmail时,它会报告"Permission denied“,并且上面的任何操作都没有帮助,请尝试此方法。
多年来,我经历了上述所有系统和无数系统,无论用户是什么,sendmail上的setgid是什么,或者任何目录上的权限和所有权信息是什么,我仍然会收到错误。在每种情况下,我都发现它与现有安装的sendmail版本有关。即使是最新的。在每种情况下,我都能通过以下方式克服这个问题:
重新安装似乎解决了这个问题。
您可能需要使用更改后的QUEUEDIR更新/etc/sysconfig/sendmail和您的sendmail.cf文件的位置,然后可能运行"journalctl daemon-reload“来修复它,然后它应该可以工作。
这是sendmail的OEM安装版本的某种问题,例如缺少用户/组smmsp等。但在现代linux安装中,这是克服此问题的最简单方法。
https://stackoverflow.com/questions/23051612
复制相似问题