Sunday, January 23, 2011

how to give read access to logs

Hi,

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

  • 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>

    From solefald
  • 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.

    From MikeyB
  • 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

    From

0 comments:

Post a Comment