Why adding a user to the sudo group before we install sudo package doesn't work?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












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 :)







share|improve this question



















  • Out of interest, which Linux distribution (or Unix version) did you discover this on?
    – roaima
    Apr 29 at 6:51















up vote
2
down vote

favorite












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 :)







share|improve this question



















  • Out of interest, which Linux distribution (or Unix version) did you discover this on?
    – roaima
    Apr 29 at 6:51













up vote
2
down vote

favorite









up vote
2
down vote

favorite











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 :)







share|improve this question











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 :)









share|improve this question










share|improve this question




share|improve this question









asked Apr 28 at 23:07









JAAAY

14115




14115











  • Out of interest, which Linux distribution (or Unix version) did you discover this on?
    – roaima
    Apr 29 at 6:51

















  • Out of interest, which Linux distribution (or Unix version) did you discover this on?
    – roaima
    Apr 29 at 6:51
















Out of interest, which Linux distribution (or Unix version) did you discover this on?
– roaima
Apr 29 at 6:51





Out of interest, which Linux distribution (or Unix version) did you discover this on?
– roaima
Apr 29 at 6:51











1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










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:



  1. sudo executable needs to be setgid

  2. your user or a group your user is in must be listed in /etc/sudoers.d

  3. 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.






share|improve this answer





















  • In fact, I accepted this question cause it sound informative to me. But the real case was that when you add a user to a group, changes will take effect from the next time he logs in.
    – JAAAY
    Apr 29 at 8:31











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440659%2fwhy-adding-a-user-to-the-sudo-group-before-we-install-sudo-package-doesnt-work%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote



accepted










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:



  1. sudo executable needs to be setgid

  2. your user or a group your user is in must be listed in /etc/sudoers.d

  3. 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.






share|improve this answer





















  • In fact, I accepted this question cause it sound informative to me. But the real case was that when you add a user to a group, changes will take effect from the next time he logs in.
    – JAAAY
    Apr 29 at 8:31















up vote
3
down vote



accepted










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:



  1. sudo executable needs to be setgid

  2. your user or a group your user is in must be listed in /etc/sudoers.d

  3. 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.






share|improve this answer





















  • In fact, I accepted this question cause it sound informative to me. But the real case was that when you add a user to a group, changes will take effect from the next time he logs in.
    – JAAAY
    Apr 29 at 8:31













up vote
3
down vote



accepted







up vote
3
down vote



accepted






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:



  1. sudo executable needs to be setgid

  2. your user or a group your user is in must be listed in /etc/sudoers.d

  3. 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.






share|improve this answer













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:



  1. sudo executable needs to be setgid

  2. your user or a group your user is in must be listed in /etc/sudoers.d

  3. 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.







share|improve this answer













share|improve this answer



share|improve this answer











answered Apr 28 at 23:30









Lie Ryan

61337




61337











  • In fact, I accepted this question cause it sound informative to me. But the real case was that when you add a user to a group, changes will take effect from the next time he logs in.
    – JAAAY
    Apr 29 at 8:31

















  • In fact, I accepted this question cause it sound informative to me. But the real case was that when you add a user to a group, changes will take effect from the next time he logs in.
    – JAAAY
    Apr 29 at 8:31
















In fact, I accepted this question cause it sound informative to me. But the real case was that when you add a user to a group, changes will take effect from the next time he logs in.
– JAAAY
Apr 29 at 8:31





In fact, I accepted this question cause it sound informative to me. But the real case was that when you add a user to a group, changes will take effect from the next time he logs in.
– JAAAY
Apr 29 at 8:31













 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440659%2fwhy-adding-a-user-to-the-sudo-group-before-we-install-sudo-package-doesnt-work%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?