Chapter 8. Managing sudo access
System administrators can grant
sudo access to allow non-root users to execute administrative commands. The
sudo command provides users with administrative access without using the password of the
When users need to perform an administrative command, they can precede that command with
sudo. The command is then executed as if they were the
Be aware of the following limitations:
Only users listed in the
/etc/sudoersconfiguration file can use the
The command is executed in the shell of the user, not in the
8.1. Granting sudo access to a user
A non-root user requires sudo access to perform administrative commands. The following section describes how to grant
sudo access to a user.
/etc/sudoersfile defines the policies applied by the
/etc/sudoersfile find the lines that grant
sudoaccess to users in the administrative
## Allows people in group wheel to run all commands %wheel ALL=(ALL) ALL
Make sure the line that starts with
%wheeldoes not have
#comment character before it.
- Save any changes, and exit the editor.
Add users you want to grant
sudoaccess to into the administrative
# usermod --append -G wheel username
Replace username with the name of the user.
To add the user
sarahto the administrative
# usermod --append -G wheel sarah
To verify the user is added to the administrative
wheelgroup, use the
# id sarah
The output returns:
uid=5000(sarah) gid=5000(sarah) groups=5000(sarah),10(wheel)