Write safe sudo rules and audit privilege escalation
10 steps · about 3 h 50 min · Intermediate
- A Short Introduction (article, sudo.ws, 10 min)
The official project overview shows what sudo does and points to the sudoers manual, so you start with the right mental model.
- How To Edit the Sudoers File Safely (tutorial, DigitalOcean, 20 min)
It teaches visudo, drop-in files, visudo -c and recovery from a broken file, so you can experiment without locking yourself out.
- Configure sudoers and delegate Linux rights (tutorial, Stéphane Robert, 40 min)
Its hands-on lab has you write a drop-in and prove with sudo -lU that a user can run only the intended command.
- Sudoers Manual (doc, sudo.ws, 45 min)
Once you've written a few rules, the official reference settles the exact syntax, aliases, NOPASSWD tags and logging options.
- Sudo Manual (reference, sudo.ws, 20 min)
It explains sudo -l, -U, -v and -k and sudoedit, the tools you'll use to inspect and test privileges.
- sudo best practices — granular grants, audit trails, and visudo discipline (article, StackHarbor, 15 min)
It gives worked examples of scoped automation rules and warns about wildcards and permission-mode mistakes.
- GTFOBins (reference, GTFOBins project, 25 min)
Use this catalogue to check whether a binary you plan to allow in sudoers can spawn a shell, and run the checks only on systems you own.
- AI-Assisted sudoers Least-Privilege Audits That Actually Find Holes (article, DevOps AI Toolkit, 15 min)
It contrasts a risky 'sudo vim' rule with a sudoedit rule and shows how wildcards and NOPASSWD slip through.
- Linux sudo sudoers Hardening 2026: Privilege Escalation Restriction Guide (article, Decryption Digest, 20 min)
It turns the earlier lessons into an audit routine: remove NOPASSWD, replace ALL grants, check GTFOBins, enable logging and review regularly.
- sudo and sudoers Security: Safe Rules and Logging (article, NHIMG, 20 min)
It closes with detection: logfile and I/O logging, watching /etc/sudoers.d for changes, and keeping NOPASSWD rules owned and reviewed.