Sunday, March 1, 2015

linux - Permissions on /var/log/httpd



I'm trying to arrange for the permissions on /var/log/httpd to be set so that httpd can write its log files there, but I can't seem to make it work. I've chowned the directory to apache:apache, and chmoded it 777:



# ls -l /var/log
[...]

drwxrwxrwx 2 apache apache 4096 Aug 26 15:55 httpd


So why the heck can't the apache user write files to that directory?



# sudo -u apache touch /var/log/httpd/foo
touch: cannot touch `/var/log/httpd/foo': Permission denied


What's going on here?



Answer



The apache user needs to be able to traverse the directory tree to /var/log/httpd so ensure that at some permission level each of the directories /var, /var/log and /var/log/httpd have an x bit set that will allow this.



Check that there are no acls set that affect the apache user getfacl can help you determine this.



Check that there are no extended file attributes that are affecting the apache user lsattr with explanation in the chattr manual.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...