Verify group of process was set correctly when launched

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











up vote
0
down vote

favorite












I am setting the group of a process when I launch it by doing the following:



sudo -g offline "/home/natral/apps/some-app/bin/app.sh" %f


after the process is running how can I verify the name of the user and group it is running as? I checked ps aux and this would tell me the user but not the group. Then I tried ps -eo uid,gid,args and managed to find the GID but how can I verify that the GID is indeed the group "offline"?







share|improve this question
























    up vote
    0
    down vote

    favorite












    I am setting the group of a process when I launch it by doing the following:



    sudo -g offline "/home/natral/apps/some-app/bin/app.sh" %f


    after the process is running how can I verify the name of the user and group it is running as? I checked ps aux and this would tell me the user but not the group. Then I tried ps -eo uid,gid,args and managed to find the GID but how can I verify that the GID is indeed the group "offline"?







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am setting the group of a process when I launch it by doing the following:



      sudo -g offline "/home/natral/apps/some-app/bin/app.sh" %f


      after the process is running how can I verify the name of the user and group it is running as? I checked ps aux and this would tell me the user but not the group. Then I tried ps -eo uid,gid,args and managed to find the GID but how can I verify that the GID is indeed the group "offline"?







      share|improve this question












      I am setting the group of a process when I launch it by doing the following:



      sudo -g offline "/home/natral/apps/some-app/bin/app.sh" %f


      after the process is running how can I verify the name of the user and group it is running as? I checked ps aux and this would tell me the user but not the group. Then I tried ps -eo uid,gid,args and managed to find the GID but how can I verify that the GID is indeed the group "offline"?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 7 '17 at 21:13









      natral

      80113




      80113




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You can use user and group in place of uid and gid to have ps show you the group and user names instead of the numbers. And of course, if you have the process id, you don't need to browse the whole list ps -e gives you, but could just use something like this



          $ ps -o pid,user,group,args -p "$pid"


          or if you don't have the PID, pgrep could find it for you:



          $ ps -o pid,user,group,args -p $(pgrep -f app.sh)


          But I do suspect sudo would give an error if it couldn't set the group id to the one you want.






          share|improve this answer



























            up vote
            2
            down vote













            If you have the GID value, getent group $GID will give you back all details regarding group whose id is $ID including its name.



            Alternatively you can also do getent group offline and see if the number you get back is the one you see in ps output.






            share|improve this answer




















            • I get a result saying offline:x:1003: what does the x mean here?
              – natral
              Dec 7 '17 at 21:30










            • It is a placeholder (for the group password, like user have passwords, groups can have too, but AFAIK this feature is nowhere used nowadays), so as long as you get a reply you are fine.
              – Patrick Mevzek
              Dec 7 '17 at 21:32










            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%2f409580%2fverify-group-of-process-was-set-correctly-when-launched%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            You can use user and group in place of uid and gid to have ps show you the group and user names instead of the numbers. And of course, if you have the process id, you don't need to browse the whole list ps -e gives you, but could just use something like this



            $ ps -o pid,user,group,args -p "$pid"


            or if you don't have the PID, pgrep could find it for you:



            $ ps -o pid,user,group,args -p $(pgrep -f app.sh)


            But I do suspect sudo would give an error if it couldn't set the group id to the one you want.






            share|improve this answer
























              up vote
              1
              down vote



              accepted










              You can use user and group in place of uid and gid to have ps show you the group and user names instead of the numbers. And of course, if you have the process id, you don't need to browse the whole list ps -e gives you, but could just use something like this



              $ ps -o pid,user,group,args -p "$pid"


              or if you don't have the PID, pgrep could find it for you:



              $ ps -o pid,user,group,args -p $(pgrep -f app.sh)


              But I do suspect sudo would give an error if it couldn't set the group id to the one you want.






              share|improve this answer






















                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                You can use user and group in place of uid and gid to have ps show you the group and user names instead of the numbers. And of course, if you have the process id, you don't need to browse the whole list ps -e gives you, but could just use something like this



                $ ps -o pid,user,group,args -p "$pid"


                or if you don't have the PID, pgrep could find it for you:



                $ ps -o pid,user,group,args -p $(pgrep -f app.sh)


                But I do suspect sudo would give an error if it couldn't set the group id to the one you want.






                share|improve this answer












                You can use user and group in place of uid and gid to have ps show you the group and user names instead of the numbers. And of course, if you have the process id, you don't need to browse the whole list ps -e gives you, but could just use something like this



                $ ps -o pid,user,group,args -p "$pid"


                or if you don't have the PID, pgrep could find it for you:



                $ ps -o pid,user,group,args -p $(pgrep -f app.sh)


                But I do suspect sudo would give an error if it couldn't set the group id to the one you want.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 7 '17 at 21:30









                ilkkachu

                50.1k676138




                50.1k676138






















                    up vote
                    2
                    down vote













                    If you have the GID value, getent group $GID will give you back all details regarding group whose id is $ID including its name.



                    Alternatively you can also do getent group offline and see if the number you get back is the one you see in ps output.






                    share|improve this answer




















                    • I get a result saying offline:x:1003: what does the x mean here?
                      – natral
                      Dec 7 '17 at 21:30










                    • It is a placeholder (for the group password, like user have passwords, groups can have too, but AFAIK this feature is nowhere used nowadays), so as long as you get a reply you are fine.
                      – Patrick Mevzek
                      Dec 7 '17 at 21:32














                    up vote
                    2
                    down vote













                    If you have the GID value, getent group $GID will give you back all details regarding group whose id is $ID including its name.



                    Alternatively you can also do getent group offline and see if the number you get back is the one you see in ps output.






                    share|improve this answer




















                    • I get a result saying offline:x:1003: what does the x mean here?
                      – natral
                      Dec 7 '17 at 21:30










                    • It is a placeholder (for the group password, like user have passwords, groups can have too, but AFAIK this feature is nowhere used nowadays), so as long as you get a reply you are fine.
                      – Patrick Mevzek
                      Dec 7 '17 at 21:32












                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    If you have the GID value, getent group $GID will give you back all details regarding group whose id is $ID including its name.



                    Alternatively you can also do getent group offline and see if the number you get back is the one you see in ps output.






                    share|improve this answer












                    If you have the GID value, getent group $GID will give you back all details regarding group whose id is $ID including its name.



                    Alternatively you can also do getent group offline and see if the number you get back is the one you see in ps output.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 7 '17 at 21:21









                    Patrick Mevzek

                    2,0381721




                    2,0381721











                    • I get a result saying offline:x:1003: what does the x mean here?
                      – natral
                      Dec 7 '17 at 21:30










                    • It is a placeholder (for the group password, like user have passwords, groups can have too, but AFAIK this feature is nowhere used nowadays), so as long as you get a reply you are fine.
                      – Patrick Mevzek
                      Dec 7 '17 at 21:32
















                    • I get a result saying offline:x:1003: what does the x mean here?
                      – natral
                      Dec 7 '17 at 21:30










                    • It is a placeholder (for the group password, like user have passwords, groups can have too, but AFAIK this feature is nowhere used nowadays), so as long as you get a reply you are fine.
                      – Patrick Mevzek
                      Dec 7 '17 at 21:32















                    I get a result saying offline:x:1003: what does the x mean here?
                    – natral
                    Dec 7 '17 at 21:30




                    I get a result saying offline:x:1003: what does the x mean here?
                    – natral
                    Dec 7 '17 at 21:30












                    It is a placeholder (for the group password, like user have passwords, groups can have too, but AFAIK this feature is nowhere used nowadays), so as long as you get a reply you are fine.
                    – Patrick Mevzek
                    Dec 7 '17 at 21:32




                    It is a placeholder (for the group password, like user have passwords, groups can have too, but AFAIK this feature is nowhere used nowadays), so as long as you get a reply you are fine.
                    – Patrick Mevzek
                    Dec 7 '17 at 21:32

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409580%2fverify-group-of-process-was-set-correctly-when-launched%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)