Security – CentOS apache startup config file security error

apache-2.2centos6configurationSecurity

I am setting up a NetDisco machine on CentOS, which entails adding an include to the apache httpd.conf file.

When I start apache by running "httpd" from a root command prompt, the process launches.

When I try start apache by running "service httpd start", I get the following output:

Starting httpd: httpd: Syntax error on line 1010 of /etc/httpd/conf/httpd.conf: 
Could not open configuration file /usr/local/netdisco/netdisco_apache.conf: 
Permission denied
                                                                  [FAILED]

That file has these permissions:

-rw-r--r--. 1 root root  1798 Apr 22 18:46 netdisco_apache.conf

And httpd.conf has these permissions:

-rw-r--r--. 1 root root 34520 Apr 22 17:06 httpd.conf

What gives, surely a file with the EXACT same permissions should be accessible to the apache service?

Best Answer

Try checking the permissions on the folder that contains netdisco_apache.conf

You are right Apache should be able to access the file as it has the same permissions, but it might not be able to access the folder it is contained in.

If you don't want to change folder permissions, just move netdisco_apache.conf to the /etc/httpd/conf directory (remember to update the reference to it in the /etc/httpd/conf/httpd.conf file if you do that.)