Write auditd rules to watch sensitive files and privileged commands.
IntermediateProductionUser Lifecycle, Auditing & Time Sync
Answer
# /etc/audit/rules.d/50-custom.rules
-w /etc/passwd -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/sudoers -p wa -k sudoers
-w /etc/sudoers.d/ -p wa -k sudoers
-w /etc/ssh/sshd_config -p wa -k sshd
-a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -F auid!=4294967295 -k root_cmds
-e 2
sudo augenrules --load
-p wa = write and attribute changes; -k tags events for searching; -e 2 makes rules immutable until reboot.
More on User Lifecycle, Auditing & Time Sync
How do you manage Linux users across hundreds of servers?BeginnerWhat is SSSD?IntermediateWhat should happen in the offboarding process for an engineer with server access?IntermediateHow do you safely remove a local user?BeginnerHow should service accounts be created and governed?IntermediateHow do you review who has access to a server?Intermediate