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 →
- 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
- Search for their keys in other accounts:
grep -r "bob@" /home/*/.ssh/authorized_keys /root/.ssh/authorized_keys. - Check
crontab -l -u boband running services owned by them. - 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.
More on Users, groups and access control
You need to onboard 50 new developers onto a shared build server, each with their own account and SSH key. How do you do it?BeginnerThree teams share one server and each needs a project directory only its members can write to, with new files staying group-owned. How do you set it up?BeginnerA junior engineer needs to restart nginx but must not get full root. How do you grant that?BeginnerA service account for a backup tool must exist on every server but nobody should be able to log in as it. How do you create it?BeginnerYour security team requires passwords to expire every 90 days for human users only. How do you implement it?BeginnerTwo developers need read access to `/var/log/app/` without being added to the `adm` or root group. How?Intermediate