Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

I have followed http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html but am getting a FAILED error when trying to restart or reload postfix.

When I do:

cat maillog

I get:

fatal: open /etc/postfix/main.cf: Permission denied

Here is what I have tried:

chown postfix /etc/postfix/main.cf
chmod u+rwx /etc/postfix/main.cf

After that, I do:

ls -l /etc/postfix/main.cf

Which gives me:

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

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.

Thanks

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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

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

share|improve this answer
    
Beautiful. Green OKs. THANKS! –  MG55114 Apr 29 '13 at 18:44

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 main.cf 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/main.cf

Try these to set proper context:

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

To verify:

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

Your Answer

 
discard

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.