Lockdown Lab #16 HIGH Linux (Ubuntu/RHEL)

Restrict sudo access

Restrict sudo access

How many times have we seen an attacker gain a foothold, then immediately escalate privileges because everyone has sudo access? It’s not a theoretical threat; it’s a daily reality for incident responders.

Giving every developer or even every admin blanket sudo privileges is asking for trouble. It’s a massive blast radius waiting to happen. If their account is compromised, the game is over.

Your default posture must be least privilege. Limit sudo access to a very small, dedicated group of administrators. Even then, they should be using it sparingly and only when absolutely necessary. Audit your sudoers file regularly.

To see who has ALL privileges right now: grep -r ‘‘ALL’’ /etc/sudoers /etc/sudoers.d/ To edit your sudoers file safely: sudo visudo

If you’re not explicitly restricting and auditing sudo, you’re leaving a gaping hole. This is basic hygiene, but it’s often overlooked in complex environments.

The fix

# List current sudo users

grep -r ''ALL'' /etc/sudoers /etc/sudoers.d/

# Restrict to admin group only

sudo visudo

# Ensure: %admin ALL=(ALL:ALL) ALL

Reference: CIS Linux Benchmark 5.3

Mark this as done

Open the interactive hardening checklist and tick this off in your environment.

Open interactive checklist →

Related Posts

Set password complexity and aging

Weak passwords are still the number one attack vector. Period. I've seen countless environments where a breach started with a simple brute-force or credential stuffing...

lockdown-labhardeninglinuxidentity
/Shimi Cohen

Enforce SSH key-based authentication

Let's talk about the lowest hanging fruit for botnets: password-based SSH. If you're still allowing it, you're not just leaving a door open; you're putting...

lockdown-labhardeninglinuxidentity
/Shimi Cohen