Centos – Impossible to start named on Centos

bindcentoscentos6centos6.5domain-name-system

I installed bind on Centos 6.5 with yum install bind-chroot bind-utils.
It's not the first time I do this and generally this works fine.

But now I try this on some server and it doesn't work at all.

When doing # service named start
I get this error:

Starting named:
Error in named configuration:
none:0: open: /etc/named.conf: permission denied

ls -l /etc/named.conf returns this:

-rw-r—–. 1 root named 817 Dec 31 12:09 /etc/named.conf

I tried chmod 777 /etc/named.conf but I still get the same error when trying to start named.

Any idea what's happening here?
Thanks for your help.

EDIT:

sestatus returns this:

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

Does that mean that SELinux is interfering here?
That would be strange as I never installed SELinux. Could it have been automatically installed with a Centos update?

Best Answer

Check with ls -Z if SELinux context is the same in /etc/named.conf and /var/named/chroot/etc/named.conf. If is not, use chcon with the --reference option to set the chrooted named.conf the same as the regular named.conf, with something like this:

chcon --reference=/etc/named.conf /var/named/chroot/etc/named.conf
Related Topic