apache 当apache在linux上发送邮件时对sendmail.cf的适当权限

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1045095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:48:25  来源:igfitidea点击:

Proper permission for sendmail.cf when apache sends mail on linux

linuxapachesendmail

提问by Atma

I have a web application (bugzilla) in apache that needs to use sendmail.cf . When it tries to use sendmail I get the error:

我在 apache 中有一个需要使用 sendmail.cf 的网络应用程序(bugzilla)。当它尝试使用 sendmail 时,我收到错误消息:

/etc/mail/sendmail.cf: line 0: cannot open: Permission denied

/etc/mail/sendmail.cf:第 0 行:无法打开:权限被拒绝

the web application is in group "apache"

Web 应用程序在“apache”组中

Permissions for sendmail look like:

sendmail 的权限如下所示:

-rw-r--r-- 1 root root 58624 2008-03-29 05:27 sendmail.cf

-rw-r--r-- 1 根 58624 2008-03-29 05:27 sendmail.cf

What do the permissions for sendmail.cf have to look like in order to be accessed by apache but still be secure enough to lock out everyone else.

sendmail.cf 的权限必须是什么样子才能被 apache 访问,但仍然足够安全以锁定其他所有人。

采纳答案by TML

You should have a different .cf file for local submissions, usually called (something like) submit.cf - this will have a slightly different batch of settings specifically for SENDING mail (whereas sendmail.cf will be the part for RECEIVING mail). The submit.cf is safe to be globally readable, because (in theory) all processes on the box should be trusted to send email.

您应该有一个不同的 .cf 文件用于本地提交,通常称为(类似于) submit.cf - 这将具有专门用于发送邮件的一组略有不同的设置(而 sendmail.cf 将是接收邮件的部分)。submit.cf 对全局可读是安全的,因为(理论上)盒子上的所有进程都应该被信任来发送电子邮件。

回答by Nelson Daza

I have this issue in a Centos 7 and the answer was here: http://www.mysysadmintips.com/linux/servers/591-sendmail-won-t-send-emails-on-centos-7-permission-denied

我在 Centos 7 中有这个问题,答案在这里:http: //www.mysysadmintips.com/linux/servers/591-sendmail-won-t-send-emails-on-centos-7-permission-denied

Quick 'sestatus' check revealed that the issue was caused by SELinux.

Running: getsebool httpd_can_sendmailreturns off, which means that Apache (httpd) doesn't have permission to send emails.

The issue was resolved by running: setsebool -P httpd_can_sendmail on

快速的“sestatus”检查显示该问题是由 SELinux 引起的。

运行:getsebool httpd_can_sendmail返回off,这意味着 Apache (httpd) 没有发送电子邮件的权限。

该问题已通过运行解决:setsebool -P httpd_can_sendmail on

回答by shuckster

Set the user as root and the group as apache: chown root:apache sendmail.cf

设置用户为root,组为apache:chown root:apache sendmail.cf