sudoers file, you can have either of the following lines
modernNeo ALL=(ALL:ALL) ALL modernNeo ALL=(ALL) ALL
I looked at the following answers on here to understand this
- Sudoers file, enable NOPASSWD for user, all commands
- What is the difference between
root ALL=(ALL:ALL) ALLand
root ALL=(ALL) ALL?
- Effect of (ALL:ALL) in sudoers?
- What does "ALL ALL=(ALL) ALL" mean in sudoers?
If I understand correctly from those above answers:
(ALL:ALL)means that you can run the command as any user and any group
(ALL)means that you can run the command as any user but your group remains the same [it remains your own group] - regardless of the user you become when you use
ALLfor the third entry?
- If you can run it as any group, how does sudo decide what group you run the command as if you don't specify it on the commandline using
- does it first try to run it as your own group and then go through a list of all the groups on your machine before finding the group that allows you to run the command?
- Where does it get the list of groups from and what is the order of the groups on that list?
- Or does it just revert to using
rootfor user and/or group when your preference for what user and/or group you want to become isn't specified? If that is the case, why do
(ALL:ALL)when you can do
Furthermore, in this Ubuntu Forums post, with regards to the following lines
%admin ALL=(ALL) ALL %sudo ALL=(ALL:ALL) ALL
They say that
Users in the admin group may become root. Users in the sudo group can only use the sudo command. For instance, they could not
sudowill use. It can be specified with
-gwhen you run
sudo. If you don't specify anything it will run as
root:root, which is the default. That's how most end up using it anyway.
That confuses me; they are stating that if you can take on any group when running a command, then you are unable to become root?