How do you review who has access to a server?
IntermediateProductionUser Lifecycle, Auditing & Time Sync
Answer
getent passwd | awk -F: '$3>=1000 && $7 !~ /nologin|false/' # interactive users
getent group sudo wheel # admins
sudo grep -rv '^#' /etc/sudoers /etc/sudoers.d/ | grep -v '^\s*$'
sudo find /home /root -name authorized_keys -exec wc -l {} +
lastlog | grep -v 'Never logged in'
last -n 20
Automate this as a periodic access review report for compliance.
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?IntermediateWhat is auditd and what is it used for?Beginner