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?
2 Answers
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
-
@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 ?– rahulCommented Nov 28, 2012 at 12:51
-
It much safer to just use
su
orsudo
to access the relevant files.– terdonCommented Nov 28, 2012 at 12:53 -
i dont know root password so I cant use
su
andsudo
doestn work withcd
command because it is shell command not bin– KrystianCommented Nov 28, 2012 at 13:04 -
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.