Does su always change ruid, euid and suid to the same user id?

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











up vote
1
down vote

favorite












Does su always change ruid, euid and suid to the same user id, or just some of them?



I feel all of them, because the process which is executing su is always run with superuser privileges, and in which case, setuid() sets all three kinds of user ids to the same value.



Thanks.







share|improve this question























    up vote
    1
    down vote

    favorite












    Does su always change ruid, euid and suid to the same user id, or just some of them?



    I feel all of them, because the process which is executing su is always run with superuser privileges, and in which case, setuid() sets all three kinds of user ids to the same value.



    Thanks.







    share|improve this question





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Does su always change ruid, euid and suid to the same user id, or just some of them?



      I feel all of them, because the process which is executing su is always run with superuser privileges, and in which case, setuid() sets all three kinds of user ids to the same value.



      Thanks.







      share|improve this question











      Does su always change ruid, euid and suid to the same user id, or just some of them?



      I feel all of them, because the process which is executing su is always run with superuser privileges, and in which case, setuid() sets all three kinds of user ids to the same value.



      Thanks.









      share|improve this question










      share|improve this question




      share|improve this question









      asked May 4 at 0:46









      Tim

      22.6k63223401




      22.6k63223401




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Yes: as you say, su runs with superuser privileges, so setuid sets all three user ids.



          As explained in the rationale in the POSIX spec for setuid, this behaviour is necessary: otherwise the process started by su would be able to setuid back to the original user, which is not desirable.






          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%2f441681%2fdoes-su-always-change-ruid-euid-and-suid-to-the-same-user-id%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
            1
            down vote













            Yes: as you say, su runs with superuser privileges, so setuid sets all three user ids.



            As explained in the rationale in the POSIX spec for setuid, this behaviour is necessary: otherwise the process started by su would be able to setuid back to the original user, which is not desirable.






            share|improve this answer

























              up vote
              1
              down vote













              Yes: as you say, su runs with superuser privileges, so setuid sets all three user ids.



              As explained in the rationale in the POSIX spec for setuid, this behaviour is necessary: otherwise the process started by su would be able to setuid back to the original user, which is not desirable.






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                Yes: as you say, su runs with superuser privileges, so setuid sets all three user ids.



                As explained in the rationale in the POSIX spec for setuid, this behaviour is necessary: otherwise the process started by su would be able to setuid back to the original user, which is not desirable.






                share|improve this answer













                Yes: as you say, su runs with superuser privileges, so setuid sets all three user ids.



                As explained in the rationale in the POSIX spec for setuid, this behaviour is necessary: otherwise the process started by su would be able to setuid back to the original user, which is not desirable.







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered May 4 at 4:17









                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%2f441681%2fdoes-su-always-change-ruid-euid-and-suid-to-the-same-user-id%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)