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

How can i give read access to logs for other users? Perhaps the solution is to set group for this files and add some users there. But how to do that for /var/log/maillog? I mean, logrotate will reset perms? If i change group from root to another won't it generate any problems?

Actual state: -rw------- 1 root root 337M kwi 22 15:40 maillog

share|improve this question

3 Answers 3

up vote 1 down vote accepted

You can add an entry to /etc/logrotate.conf or wherever your config for the particular log is (most likely in /etc/logrotate.d/<blah>)

create 0664 root utmp

This tells logrotate to create a new log with 664 permissions and make it owned by user root and group utmp.

You will probably want something like create 0644 root root, unless you only want a specific group to have read access. in that case make it create 0640 root <your group>

share|improve this answer

What syslog engine are you using? syslog-ng may be handling file permissions.

You will have lines such as:

# Default permissions
options { perm(0640); }; 

# Custom file target
destination localmessages { file("/var/log/localmessages" perm(0644)); };

If you're using syslog-ng, use its capabilities to set your logfile permissions in general.

If you need specific things (i.e. fred needs to see /var/log/mail) I recommend using sudo instead.

share|improve this answer

Thanks for all answers, i have used sudo and it works brilliant. Something like that:

user1, user2, user3 ALL=NOPASSWD: /bin/cat /var/log/maillog

rgrds

share|improve this answer

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.