Developers keep running `sudo su -` and doing everything as root. How do you change that without blocking their work?
IntermediateScenarioUsers, groups and access control
Answer
Situation read → Shared root sessions destroy accountability; replace with per-command sudo.
What I'd do →
- List what they actually need (restart services, read logs, deploy) from sudo logs.
- Write
Cmnd_Aliasrules for those commands in/etc/sudoers.d/. - Remove the broad
ALLrule, and explicitly deny shells:!/bin/su, !/usr/bin/su, !/bin/bash(as defence, knowing deny lists are bypassable). - Give the team
journalctlaccess via thesystemd-journalgroup instead of sudo. - Communicate, roll out to one server, then the fleet.
Why → Every action gets tied to a named user in the logs.
Interview tip → Admit deny lists in sudo are weak; allow lists are the real control.
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?BeginnerAn engineer leaves the company today. What do you do with their Linux account on 30 servers?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?Beginner