Best Practices·Linux Foundation Certified System Administrator
sudo, and what it actually grants
Granting one command is a task you will be given, and the trap is that a narrow rule is often not narrow at all. This guide writes a rule into /etc/sudoers.d, validates it before installing it, checks what the user can and cannot do - and then grants exactly one more command and uses it to read /etc/shadow.
Users and Groups Guide 21 of 38 Advanced
- PlatformsUbuntu 26.04 LTS + AlmaLinux 10.2
- LVM2.03.31 (Ubuntu) / 2.03.36 (AlmaLinux)
- nftables1.1.6 (Ubuntu) / 1.1.5 (AlmaLinux)
- TimeAbout 18 min
sudo on both families. The admin group is %wheel on RHEL and %sudo on Debian and Ubuntu, and /etc/sudoers.d with an includedir is standard on both.
- Firewallufw 0.36.2 enabled but reporting inactive / firewalld active
- Network confignetplan + systemd-networkd / NetworkManager 1.56.0
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LFCS-A01 | 192.168.0.70 | Ubuntu 26.04 LTS | Primary host - most guides run only here | 2 Core | 4 GB | 50 GB |
| LFCS-C01 | 192.168.0.72 | AlmaLinux 10.2 | The other distribution - dnf, firewalld and NetworkManager | 2 Core | 4 GB | 50 GB |
This guide includes
Use this because granting one command is a task you will be given. This matters because a narrow rule can be a wide one - grant find and you have granted everything find can run.
- reading the rules already in effect for a user
- writing a rule of your own, and checking it before it is installed
- testing what that user can and cannot then do
- seeing how a narrow grant turns out to be wide
- finding where sudo records what happened, and the two names that differ between families
Before you start
-
What sudo already allows
-
A rule of your own, checked before it is installed
-
What that user can and cannot do
-
And how a narrow rule turns out to be wide
-
Where sudo records what happened
-
The group is not called the same thing, and nor is the log