I just did this "mistake" and it took me a while to figure it out! Can anybody explain me what happens behind the scenes of this "bug"? Thanks in advance :)
This is really just how your distro had packaged sudo.
There's nothing special about the sudo group, it's just a normal Linux group.
The power of the sudo group comes from being listed in /etc/sudoers(.d) as being allowed to elevate to root for any commands.
There are a couple things that is necessary for sudo to work:
- sudo executable needs to be setgid
- your user or a group your user is in must be listed in /etc/sudoers.d
- your user must be logged into the group when running sudo
If either of these is untrue, for example, if your distro recreated the sudo group, for example because it wants the sudo group to have a specific gid, while installing sudo for the first time, then it's possible that your sudo won't work.
Another common mistake is that right after adding a user to a group, your existing process won't have the new permission immediately, you'll need to either use grp or restart the login shell to get the permissions of the new group.