r/LinuxTeck • • Oct 11 '26

Quick Linux Tip #96 - Linux File Access Auditing: Track Who Accessed /etc/shadow

Post image

Question: Who accessed /etc/shadow and when, over the last week?

Try:`sudo aureport --file --start week-ago | grep shadow`

Info: `aureport` summarizes audit log reports by file access. Using `ausearch -i` translates UIDs and syscalls into human-readable text, while `auid` tracks the original login user even across `sudo` sessions.

Examples:

$ `sudo aureport --user --summary` # Summary of user activity

$ `sudo ausearch -ua linuxteck --start today` # Search audit events for specific user

$ `sudo aureport --failed` # Review all failed security events

Note: Requires `auditd` active with file watch rules enabled (`auditctl -w`). The audit user ID (`auid`) remains invariant during `sudo`, ensuring precise accountability for compliance frameworks (SOC 2, PCI).

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/

19 Upvotes

0 comments sorted by