Linux – lighttpd: opening errorlog failed: Permission denied

lighttpdlinux

this happens when I restart the lighttpd and it backups the old log and creates new one.

Is there any way so I don't have to changed permissions or ownership for that file every time the server is restarted and new log file created?

the file in question before doing chmod 777 * in the log directory was

-rw-r--r-- 1 root eduserver 1.9M Jun 16 13:41 access.log
-rwxrwxrwx 1 root eduserver  79K Apr 29 09:45 access.log-20110429.bz2*
-rwxrwxrwx 1 root eduserver  53K Apr 30 09:45 access.log-20110430.bz2*
-rwxrwxrwx 1 root eduserver  55K May  4 09:45 access.log-20110504.bz2*
-rwxrwxrwx 1 root eduserver 109K May 13 09:45 access.log-20110513.bz2*

Best Answer

You can do one of the following things:

1- Edit the start/stop/restart script by doing the needed chmod and/or chown commands. So, it will be done automatically each time you restart the server.

2- Add your user to the needed group if applicable. So, there is no need to do sudo or change the permissions. Suppose the restart process creates a new file which can be read by group lighttpd. Add your user to this group.

By the way, if you can use logrotate, it has an option to specify the file permissions. As an example, you can use create 640 root adm.