Interview Prep/Linux/Users, groups and access control

An engineer leaves the company today. What do you do with their Linux account on 30 servers?

BeginnerScenarioUsers, groups and access control
Answer

Situation read → Revoke access immediately but keep data and audit trail.

What I'd do →

  1. Lock the account and kill sessions:
sudo usermod -L -e 1 bob        # lock password, expire account
sudo pkill -KILL -u bob
sudo mv /home/bob/.ssh/authorized_keys /root/offboard-bob.keys
  1. Search for their keys in other accounts: grep -r "bob@" /home/*/.ssh/authorized_keys /root/.ssh/authorized_keys.
  2. Check crontab -l -u bob and running services owned by them.
  3. After the retention period, archive the home dir and userdel -r bob.

Why → Locking first is reversible; deleting right away can break jobs or ownership that nobody knew depended on that user.

Interview tip → Say you do this from a central tool (Ansible, IdP/LDAP disable) so no server is missed.

All Linux questions Roadmap: Linux

More on Users, groups and access control