0

Ubuntu newbie here!

As far as I understand groups exist so that file permissions can easily be assigned to many users at once, or to allow specific applications to access files securely, such as with the shadow group. But why does adding a user to the sudo group allow him to use the sudo command?

At first i thought that its because the binaries for sudo are owned by the sudo group. But after running ls -l it seems that isn't the case.

ls -l /bin/sudo
-rwsr-xr-x 1 root root 232416 Aug  4 13:35 /bin/sudo

What mechanism exists that allows the users of a group access to a command?

1 Answer 1

1

As you can see, the /bin/sudo binary has the suid bit set as its permissions (Pay attention to the s in -rwsr-xr-x). It means no matter who invokes it, It gets run by its owner which is the root user.

After that it checks the /etc/sudoers and files within /etc/sudoers.d directory for its configurations to detect whatever you're permitted to use sudo or not. That's where it has been defined that users in sudo group are allowed to use sudo:

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
1
  • That makes sense! Thank you so much!
    – Big_Duck
    Jan 1, 2023 at 19:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .