Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I would like to make apache access log file readable by www-data (the user running the webserver) so I can serve it over HTTPS, to save me the trouble of SSHing to the server every time I want to check it.

I tried chmod o+r access.log, but it seems that the permissions are automatically reset to -rw-r----- 1 root adm.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

In case you'r running a logrotate, which also sets the permissions of the new log files, that might be a good place to make the change. For example, this is a default apache2 logrotate on an Ubuntu server.

andreas@halleck:~$ sudo cat /etc/logrotate.d/apache2
/var/log/apache2/*.log {
    rotate 52
    create 640 root adm
    	if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/}`" ]; then
    		/etc/init.d/apache2 reload > /dev/null

As you see there is a setting called create? Feel free to change it to whatever mode and ownership you want new log files to have. Also, here is how the create option is described in the logrotate(8) man file.

create mode owner group

Immediately after rotation (before the postrotate script is run) the log file is created (with the same name as the log file just rotated). mode specifies the mode for the log file in octal (the same as chmod(2)), owner specifies the user name who will own the log file, and group specifies the group the log file will belong to. Any of the log file attributes may be omitted, in which case those attributes for the new file will use the same values as the original log file for the omitted attributes. This option can be disabled using the nocreate option.

share|improve this answer
Thanks, this is exactly what I needed. –  Ofri Raviv Dec 12 '09 at 17:58

I got this working by changing the ownership of the file (that does not seem to be automatically reset). Is that the right way?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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