Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to set up a postfix server for smtp relay. Centos 5.5

I have followed but am getting a FAILED error when trying to restart or reload postfix.

When I do:

cat maillog

I get:

fatal: open /etc/postfix/ Permission denied

Here is what I have tried:

chown postfix /etc/postfix/
chmod u+rwx /etc/postfix/

After that, I do:

ls -l /etc/postfix/

Which gives me:

-rwx------. 1 postfix anotheruser 27531 Apf 29 12:19 /etc/postfix/

No dice. Same error. I even tried temporarily doing chmod 777 but got same error.

Any ideas on the permissions problem? I am assuming it is running the service as the postfix user.


share|improve this question
up vote 7 down vote accepted

Almost certainly to do with SELinux. I bet you moved your into that location.

Try running restorecon -v /etc/postfix/ to fix the labelling.

share|improve this answer
Beautiful. Green OKs. THANKS! – MG55114 Apr 29 '13 at 18:44
To do a fast verification if SELinux it's the cause, disable it temporarily like this: sudo setenforce 0 If now everything works then SELinux it's the cause. Run sudo setenforce 1 to enable SELinux again and solve the problem as suggested – Metafaniel Jan 20 '15 at 19:26

This is most likely related to SELinux access control. CentOS has "Enforcing" SELinux mode by default. Please check the status of SELinux with comnand:

# sestatus

If the output something like this:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

You need to to change security context for and probably other postfix configuration flies. On my machine it is set to:

-rw-r--r--. root root system_u:object_r:postfix_etc_t:s0 /etc/postfix/

Try these to set proper context:

 # chcon -v -u system_u -r object_r -t postfix_etc_t /etc/postfix/
 # restorecon -v -R  /etc/postfix/

To verify:

 # ls -Z /etc/postfix/
share|improve this answer

In my case, the other answers didn't helped me, because I already had the context for those files correctly. Even if the file's correct context are applied, you'll also need to be sure the Apache user has SELinux permission to send mails. Specifically there is a SELinux configuration that need to be turned on.

  1. Verify if the setting is on or off: getsebool httpd_can_sendmail
  2. If you got httpd_can_sendmail --> off you can enable this setting this way: sudo setsebool -P httpd_can_sendmail 1

-P in the above command means Persistent (across reboots)

share|improve this answer
This was exactly the issue in my LEMP stack! – Andrew White May 1 at 2:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.