0

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

3 Answers 3

1

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>

1

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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .