Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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*
share|improve this question
1  
why do you want the log files executable? –  Keith Jun 16 '11 at 7:24
    
I don't want it executable, I just used 777. The server is not accessible from outside so I didn't worry if it's 777 or 555. The point is that I don't won't to run chmod manually every time the server is restarted. –  Radek Jun 16 '11 at 7:36
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
would you know which file I need to edit to specify the file permissions for logrotate? –  Radek Jun 16 '11 at 7:09
    
If you are using logrotate, you need to look for a file named something like lighttpd under /etc/logrotate.d/. This folder usually keeps the logrotate config files. –  Khaled Jun 16 '11 at 7:33
    
found it. I guess that chmod 644 /opt/eduserver/log/access.log is what I need to change. Any idea how to test that it works? –  Radek Jun 16 '11 at 7:38
add comment

Your Answer

 
discard

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.