Understanding the/etc/sudoers file
In this section, let’s see how to use the ordinary user account we created earlier to carry out user administration operations.
We must make a special permissions entry for packt
in /etc/sudoers
in order to allow it special access:
packt ALL=(ALL) ALL
Let’s break down this line’s syntax:
- First, we state to which user this rule applies (
packt
). - All hosts that use the same
/etc/sudoers
file are covered by the rule if the firstALL
is present. Since the same file is no longer shared among different machines, this term now refers to the current host. - Next,
(ALL) ALL
informs us that any user may execute any command as thepackt
user. In terms of functionality, this is similar to(
root) ALL
.
It is important to manage permissions using groups as it makes life much easier. Imagine how simple it would be to just remove a user from a sudo
group rather than removing the user from 100 different places.