Sunday, 25 April 2021

Non-root access to system logs

 Access to some system logs in /var/log is restricted to root only. 

Here's a handy way to grant access read-only access to all system logs without all that mucking around with sudo and file permissions.

  • Install bindfs from the EPEL repo.
  • Create a group (eg: logs) and add all users to it who need logfile access
  • Create a mountpoint for the read-only view of /var/log (eg: /log)
  • Create a bind mount in /etc/fstab
    • /var/log  /log  fuse.bindfs     ro,force-group=logs,perms=g+rD  0 0
  • Mount /log
System logs can now be viewed in /log by any user who is a member of the logs group.
This works because bindfs forces group read access on all files in the bind mount  


No comments:

Post a Comment