Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache access log automatically set permissions

For some tests I'm doing, I'm required to remotely tail the apache access log via ssh. I can successfully do that only when the permissions are accurately set for the log. I've noticed that once a week, a new apache access.log is created and the permissions are reset.

My current work around is editing the permissions on the log once a week:

chmod 644 /var/log/apache2/access.log

I was wondering if there was a more permanent solution such as extending the time that the old log remains or automatically setting permissions when the new log is created.

If it matters, I'm running the server on Ubuntu 11.10

like image 962
Parth Avatar asked Mar 05 '12 14:03

Parth


1 Answers

Edit your logrotate.conf file to set the correct owner/permissions for the apache.log file. Something like this:

/var/log/apache2/access.log {
    weekly
    create 0644 root utmp
    rotate 1
}

(Edit: Changed mode from 0744 to 0644. No need to set the execute bit.)

like image 200
Kirby Todd Avatar answered Nov 16 '22 02:11

Kirby Todd