How does sudo achieve changing the privileges of a process?

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











up vote
0
down vote

favorite













  1. From man sudo




    When sudo executes a command, the security policy specifies the
    execution environment for the command. Typically, the real and
    effective user and group and IDs are set to match those of the target
    user
    , as specified in the password database, and the group vector is
    initialized based on the group database (unless the -P option was
    specified).




    Why does sudo change both effective and real user/group IDs to
    those of the target user, instead of just effective user/group IDs?



    Are effective user/group IDs not the only ones needed to take on the
    privileges of the target user?




  2. From https://unix.stackexchange.com/a/333245/674




    changing the effective user and group ID's of a process is only one way of changing the privileges of a process, the security policy
    defined in sudo.conf can use any other kind of parameters in the
    above list.




    In order to change the privileges, are there other ways than
    changing the effective user/group IDs? What are they?



Thanks.



My question is inspired from Does `sudo` work in terms of changing the effective user and group IDs of a process?







share|improve this question

























    up vote
    0
    down vote

    favorite













    1. From man sudo




      When sudo executes a command, the security policy specifies the
      execution environment for the command. Typically, the real and
      effective user and group and IDs are set to match those of the target
      user
      , as specified in the password database, and the group vector is
      initialized based on the group database (unless the -P option was
      specified).




      Why does sudo change both effective and real user/group IDs to
      those of the target user, instead of just effective user/group IDs?



      Are effective user/group IDs not the only ones needed to take on the
      privileges of the target user?




    2. From https://unix.stackexchange.com/a/333245/674




      changing the effective user and group ID's of a process is only one way of changing the privileges of a process, the security policy
      defined in sudo.conf can use any other kind of parameters in the
      above list.




      In order to change the privileges, are there other ways than
      changing the effective user/group IDs? What are they?



    Thanks.



    My question is inspired from Does `sudo` work in terms of changing the effective user and group IDs of a process?







    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite












      1. From man sudo




        When sudo executes a command, the security policy specifies the
        execution environment for the command. Typically, the real and
        effective user and group and IDs are set to match those of the target
        user
        , as specified in the password database, and the group vector is
        initialized based on the group database (unless the -P option was
        specified).




        Why does sudo change both effective and real user/group IDs to
        those of the target user, instead of just effective user/group IDs?



        Are effective user/group IDs not the only ones needed to take on the
        privileges of the target user?




      2. From https://unix.stackexchange.com/a/333245/674




        changing the effective user and group ID's of a process is only one way of changing the privileges of a process, the security policy
        defined in sudo.conf can use any other kind of parameters in the
        above list.




        In order to change the privileges, are there other ways than
        changing the effective user/group IDs? What are they?



      Thanks.



      My question is inspired from Does `sudo` work in terms of changing the effective user and group IDs of a process?







      share|improve this question














      1. From man sudo




        When sudo executes a command, the security policy specifies the
        execution environment for the command. Typically, the real and
        effective user and group and IDs are set to match those of the target
        user
        , as specified in the password database, and the group vector is
        initialized based on the group database (unless the -P option was
        specified).




        Why does sudo change both effective and real user/group IDs to
        those of the target user, instead of just effective user/group IDs?



        Are effective user/group IDs not the only ones needed to take on the
        privileges of the target user?




      2. From https://unix.stackexchange.com/a/333245/674




        changing the effective user and group ID's of a process is only one way of changing the privileges of a process, the security policy
        defined in sudo.conf can use any other kind of parameters in the
        above list.




        In order to change the privileges, are there other ways than
        changing the effective user/group IDs? What are they?



      Thanks.



      My question is inspired from Does `sudo` work in terms of changing the effective user and group IDs of a process?









      share|improve this question












      share|improve this question




      share|improve this question








      edited Apr 27 at 7:40









      Stephen Kitt

      140k22302363




      140k22302363









      asked Apr 27 at 2:28









      Tim

      22.6k63224401




      22.6k63224401




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          1. sudo changes both the real and effective user ids in order to restrict the resulting process’ privileges. Changing the effective id is sufficient to grant the new process the privileges of the requested user, but doing only that leaves open a gaping hole: setuid can then be used to assume the privileges of the calling user. To avoid that, sudo sets the real user id too.


          2. The list of possibilities is given in the sudo manpage and quoted in the answer you’re referring to. Some of those have an impact on the child process’ privileges: the SELinux role and type, the Solaris project and privileges, and the BSD login class.






          share|improve this answer





















            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%2f440316%2fhow-does-sudo-achieve-changing-the-privileges-of-a-process%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
            5
            down vote



            accepted










            1. sudo changes both the real and effective user ids in order to restrict the resulting process’ privileges. Changing the effective id is sufficient to grant the new process the privileges of the requested user, but doing only that leaves open a gaping hole: setuid can then be used to assume the privileges of the calling user. To avoid that, sudo sets the real user id too.


            2. The list of possibilities is given in the sudo manpage and quoted in the answer you’re referring to. Some of those have an impact on the child process’ privileges: the SELinux role and type, the Solaris project and privileges, and the BSD login class.






            share|improve this answer

























              up vote
              5
              down vote



              accepted










              1. sudo changes both the real and effective user ids in order to restrict the resulting process’ privileges. Changing the effective id is sufficient to grant the new process the privileges of the requested user, but doing only that leaves open a gaping hole: setuid can then be used to assume the privileges of the calling user. To avoid that, sudo sets the real user id too.


              2. The list of possibilities is given in the sudo manpage and quoted in the answer you’re referring to. Some of those have an impact on the child process’ privileges: the SELinux role and type, the Solaris project and privileges, and the BSD login class.






              share|improve this answer























                up vote
                5
                down vote



                accepted







                up vote
                5
                down vote



                accepted






                1. sudo changes both the real and effective user ids in order to restrict the resulting process’ privileges. Changing the effective id is sufficient to grant the new process the privileges of the requested user, but doing only that leaves open a gaping hole: setuid can then be used to assume the privileges of the calling user. To avoid that, sudo sets the real user id too.


                2. The list of possibilities is given in the sudo manpage and quoted in the answer you’re referring to. Some of those have an impact on the child process’ privileges: the SELinux role and type, the Solaris project and privileges, and the BSD login class.






                share|improve this answer













                1. sudo changes both the real and effective user ids in order to restrict the resulting process’ privileges. Changing the effective id is sufficient to grant the new process the privileges of the requested user, but doing only that leaves open a gaping hole: setuid can then be used to assume the privileges of the calling user. To avoid that, sudo sets the real user id too.


                2. The list of possibilities is given in the sudo manpage and quoted in the answer you’re referring to. Some of those have an impact on the child process’ privileges: the SELinux role and type, the Solaris project and privileges, and the BSD login class.







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered Apr 27 at 5:09









                Stephen Kitt

                140k22302363




                140k22302363






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440316%2fhow-does-sudo-achieve-changing-the-privileges-of-a-process%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?