Guide Shows How to Grant Linux Log Access Without Root

· Original article ↗

Summary

The guide explains least-privilege Linux log access using groups, narrowly scoped sudo, and rotation-safe permissions, and warns that Docker group membership effectively grants root access.

Key points

  • On Debian and Ubuntu, the adm group grants access to many text logs, while systemd-journal enables access to the system journal; permissions vary by distribution.
  • On Red Hat-family systems, /var/log/secure, /var/log/messages, and audit logs remain root-only.
  • Use usermod -aG to add groups without replacing existing memberships; changes require a new login session.
  • For root-only logs, grant specific commands through sudoers and use a root-owned wrapper without arguments to avoid wildcard argument risks.
  • Avoid granting journalctl through sudo because its pager can provide a path to a root shell; use systemd-journal group access instead.
  • ACLs set directly on log files can disappear during rotation; configure logrotate and rsyslog to create files with the intended group and permissions.
  • Docker group membership is effectively root on the host; use a log collector or SIEM, or request read-only platform access.

Article Details

Defense Focus
Enable least-privilege access to Linux logs without granting analysts root access.
Detection Methods
  • Check group memberships with id and verify log-file ownership and permissions with ls -l.
  • Inspect journal-directory ACLs with getfacl.
  • Test log access in a new login session after group membership changes.
  • Use narrowly scoped commands or a no-argument root-owned wrapper to read root-only logs.
Data Sources
  • /var/log/auth.log
  • /var/log/secure
  • /var/log/syslog
  • /var/log/messages
  • System journal
  • /var/log/audit/audit.log
  • Web server logs
  • Container logs
Platforms
  • Debian
  • Ubuntu
  • RHEL
  • Rocky
  • Alma
Defensive Actions
  • Grant log access through appropriate groups such as adm and systemd-journal, then start a new session.
  • Use narrowly scoped sudo permissions for root-only logs; avoid granting a root shell or journalctl through sudo.
  • Use a root-owned, restricted wrapper with no arguments when exposing specific root-only log-reading commands.
  • Configure logrotate and rsyslog to create rotated and new log files with the intended group and permissions.
  • Test log-rotation changes on a non-production system before deployment.
  • Do not add analysts to the docker group for log access; use a log collector, SIEM, or platform-team-provided read-only access.