access apache log files in centos

36,190

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 :)

Share:
36,190

Related videos on Youtube

Krystian
Author by

Krystian

Updated on September 18, 2022

Comments

  • Krystian
    Krystian almost 2 years

    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?

  • Krystian
    Krystian over 11 years
    I did everything but still access denied
  • rahul
    rahul over 11 years
    @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 ?
  • terdon
    terdon over 11 years
    It much safer to just use su or sudo to access the relevant files.
  • Krystian
    Krystian over 11 years
    i dont know root password so I cant use su and sudo doestn work with cd command because it is shell command not bin
  • rahul
    rahul over 11 years
    @Krystian great! cheers
  • user1696603
    user1696603 over 7 years
    better to do sudo chmod 755 /var/log/httpd and sudo chmod 644 /var/log/httpd/* -- the first is for directory access and the second for files. using chmod -R 755 makes all the files executable, which isn't a good idea. (more adaptable version of these commands here: unix.stackexchange.com/a/38451/3297)