I've got clear centOS 5.x system, I've created an user and when I want do go into /var/log/httpd i get access denied. after typing ls -la i get the owner of httpd catalog is root. Can I change owner to my user? Or how can I access this folder to watch apache logs?


The permissions are correct on the folder. You can change the ownership of the folder to root:apache and also add yourself to the apache group.

sudo chown -R root:apache /var/log/httpd 

then open the /etc/group file and add the following to the group 'apache'

sudo vi /etc/group

apache:x:48:"your username"

sudo chmod -R 755 /var/log/httpd 

Hope that solves the issue.

cheers :)

  • 1
    I did everything but still access denied – Krystian Nov 28 '12 at 12:48
  • @Krystian forgot to add one more thing.I have added that edit to the answer that i posted,in case you forgot that. Can u give me the o/p of ls -ld /var/log/httpd ? – rahul Nov 28 '12 at 12:51
  • It much safer to just use su or sudo to access the relevant files. – terdon Nov 28 '12 at 12:53
  • i dont know root password so I cant use su and sudo doestn work with cd command because it is shell command not bin – Krystian Nov 28 '12 at 13:04
  • @Krystian great! cheers – rahul Nov 29 '12 at 4:49

You can access the logs without changing the owner or permissions by temporarily logging in as root.

sudo -i and then enter the password

Keep in mind that it is inadvisable to be logged in as root when unnecessary but there is nothing wrong with it for accessing an otherwise unavailable file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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