我正在尝试为smtp中继设置一个postfix服务器。 Centos 5.5
我已经遵循http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html,但是当尝试重新启动或重新加载postfix时出现FAILED错误。
当我做:
cat maillog
我得到:
fatal: open /etc/postfix/main.cf: Permission denied
这是我所尝试的:
chown postfix /etc/postfix/main.cf chmod u+rwx /etc/postfix/main.cf
之后,我做:
ls -l /etc/postfix/main.cf
这给了我:
-rwx------. 1 postfix anotheruser 27531 Apf 29 12:19 /etc/postfix/main.cf
没有骰子。 同样的错误。 我什至尝试暂时做chmod 777,但得到同样的错误。
关于权限问题的任何想法? 我假设它正在运行该服务作为后缀用户。
谢谢
几乎可以肯定与SELinux有关。 我打赌你把你的main.cf移到了那个位置。
尝试运行restorecon -v /etc/postfix/main.cf来修复标签。
在我的情况下,其他答案没有帮助我,因为我已经正确地为这些文件的上下文。 即使应用了文件的正确上下文,也需要确保Apache用户具有发送邮件的SELinux权限。 特别是有一个SELinuxconfiguration需要打开。
getsebool httpd_can_sendmail httpd_can_sendmail --> off你可以这样启用这个设置: sudo setsebool -P httpd_can_sendmail 1 -P在上面的命令意味着永久 (跨重新启动)
这很可能与SELinux访问控制有关。 CentOS默认有“强制”SELinux模式。 请用comnand检查SELinux的状态:
# sestatus
如果输出这样的东西:
SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 24 Policy from config file: targeted
您需要更改main.cf和其他后缀configuration文件的安全上下文。 在我的机器上它被设置为:
-rw-r--r--. root root system_u:object_r:postfix_etc_t:s0 /etc/postfix/main.cf
尝试这些设置适当的上下文:
# chcon -v -u system_u -r object_r -t postfix_etc_t /etc/postfix/main.cf # restorecon -v -R /etc/postfix/
核实:
# ls -Z /etc/postfix/