What “chgrp 0” do?

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 analyzing one script and I cannot find online what chgrp 0 mean in the following line:



find $1 -follow -exec chgrp 0 


so



find $1 takes parameter,



-follow causes find to follow symlinks,



-exec executes the command,



chgrp 0 change group ownership, but what 0 do?,



for all items found by the find command.



Please correct me if I am wrong with something.










share|improve this question



























    up vote
    0
    down vote

    favorite












    I am analyzing one script and I cannot find online what chgrp 0 mean in the following line:



    find $1 -follow -exec chgrp 0 


    so



    find $1 takes parameter,



    -follow causes find to follow symlinks,



    -exec executes the command,



    chgrp 0 change group ownership, but what 0 do?,



    for all items found by the find command.



    Please correct me if I am wrong with something.










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am analyzing one script and I cannot find online what chgrp 0 mean in the following line:



      find $1 -follow -exec chgrp 0 


      so



      find $1 takes parameter,



      -follow causes find to follow symlinks,



      -exec executes the command,



      chgrp 0 change group ownership, but what 0 do?,



      for all items found by the find command.



      Please correct me if I am wrong with something.










      share|improve this question















      I am analyzing one script and I cannot find online what chgrp 0 mean in the following line:



      find $1 -follow -exec chgrp 0 


      so



      find $1 takes parameter,



      -follow causes find to follow symlinks,



      -exec executes the command,



      chgrp 0 change group ownership, but what 0 do?,



      for all items found by the find command.



      Please correct me if I am wrong with something.







      find chgrp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 21 at 15:06









      Jeff Schaller

      32.7k849110




      32.7k849110










      asked Aug 21 at 15:05









      spaceman117X

      368




      368




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          chgrp 0 file will change the group ownership of the file file to the group with GID 0 which in nearly all cases in Linux is the root group (in BSD, this is nearly always wheel). So your find command will search in the path provided by the first positional parameter ($1) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0, root (or wheel).






          share|improve this answer


















          • 1




            yes, that makes sense, thanks @DopeGhoti
            – spaceman117X
            Aug 21 at 15:12










          • Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
            – DopeGhoti
            Aug 21 at 15:14






          • 1




            On BSD systems, the group with GID zero will likely be the wheel group (which is the primary group of the root user).
            – Kusalananda
            Aug 21 at 15:43


















          up vote
          1
          down vote













          Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:



          # touch testfile
          # chgrp 135543 testfile
          # ls -l testfile
          -rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
          # groupadd -g 135543 testgroup
          # ls -l testfile
          -rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile





          share|improve this answer






















          • "Something". Fixed.
            – Alexander
            Aug 21 at 17:42










          • Yes, In my (beginners) opinion it is more logical to write chgrp root file than to assume that root group is number zero
            – spaceman117X
            Aug 22 at 6:21


















          up vote
          0
          down vote













          0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.






          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%2f463890%2fwhat-chgrp-0-do%23new-answer', 'question_page');

            );

            Post as a guest






























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            5
            down vote



            accepted










            chgrp 0 file will change the group ownership of the file file to the group with GID 0 which in nearly all cases in Linux is the root group (in BSD, this is nearly always wheel). So your find command will search in the path provided by the first positional parameter ($1) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0, root (or wheel).






            share|improve this answer


















            • 1




              yes, that makes sense, thanks @DopeGhoti
              – spaceman117X
              Aug 21 at 15:12










            • Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
              – DopeGhoti
              Aug 21 at 15:14






            • 1




              On BSD systems, the group with GID zero will likely be the wheel group (which is the primary group of the root user).
              – Kusalananda
              Aug 21 at 15:43















            up vote
            5
            down vote



            accepted










            chgrp 0 file will change the group ownership of the file file to the group with GID 0 which in nearly all cases in Linux is the root group (in BSD, this is nearly always wheel). So your find command will search in the path provided by the first positional parameter ($1) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0, root (or wheel).






            share|improve this answer


















            • 1




              yes, that makes sense, thanks @DopeGhoti
              – spaceman117X
              Aug 21 at 15:12










            • Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
              – DopeGhoti
              Aug 21 at 15:14






            • 1




              On BSD systems, the group with GID zero will likely be the wheel group (which is the primary group of the root user).
              – Kusalananda
              Aug 21 at 15:43













            up vote
            5
            down vote



            accepted







            up vote
            5
            down vote



            accepted






            chgrp 0 file will change the group ownership of the file file to the group with GID 0 which in nearly all cases in Linux is the root group (in BSD, this is nearly always wheel). So your find command will search in the path provided by the first positional parameter ($1) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0, root (or wheel).






            share|improve this answer














            chgrp 0 file will change the group ownership of the file file to the group with GID 0 which in nearly all cases in Linux is the root group (in BSD, this is nearly always wheel). So your find command will search in the path provided by the first positional parameter ($1) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0, root (or wheel).







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 21 at 15:56

























            answered Aug 21 at 15:09









            DopeGhoti

            41.1k55080




            41.1k55080







            • 1




              yes, that makes sense, thanks @DopeGhoti
              – spaceman117X
              Aug 21 at 15:12










            • Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
              – DopeGhoti
              Aug 21 at 15:14






            • 1




              On BSD systems, the group with GID zero will likely be the wheel group (which is the primary group of the root user).
              – Kusalananda
              Aug 21 at 15:43













            • 1




              yes, that makes sense, thanks @DopeGhoti
              – spaceman117X
              Aug 21 at 15:12










            • Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
              – DopeGhoti
              Aug 21 at 15:14






            • 1




              On BSD systems, the group with GID zero will likely be the wheel group (which is the primary group of the root user).
              – Kusalananda
              Aug 21 at 15:43








            1




            1




            yes, that makes sense, thanks @DopeGhoti
            – spaceman117X
            Aug 21 at 15:12




            yes, that makes sense, thanks @DopeGhoti
            – spaceman117X
            Aug 21 at 15:12












            Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
            – DopeGhoti
            Aug 21 at 15:14




            Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
            – DopeGhoti
            Aug 21 at 15:14




            1




            1




            On BSD systems, the group with GID zero will likely be the wheel group (which is the primary group of the root user).
            – Kusalananda
            Aug 21 at 15:43





            On BSD systems, the group with GID zero will likely be the wheel group (which is the primary group of the root user).
            – Kusalananda
            Aug 21 at 15:43













            up vote
            1
            down vote













            Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:



            # touch testfile
            # chgrp 135543 testfile
            # ls -l testfile
            -rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
            # groupadd -g 135543 testgroup
            # ls -l testfile
            -rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile





            share|improve this answer






















            • "Something". Fixed.
              – Alexander
              Aug 21 at 17:42










            • Yes, In my (beginners) opinion it is more logical to write chgrp root file than to assume that root group is number zero
              – spaceman117X
              Aug 22 at 6:21















            up vote
            1
            down vote













            Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:



            # touch testfile
            # chgrp 135543 testfile
            # ls -l testfile
            -rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
            # groupadd -g 135543 testgroup
            # ls -l testfile
            -rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile





            share|improve this answer






















            • "Something". Fixed.
              – Alexander
              Aug 21 at 17:42










            • Yes, In my (beginners) opinion it is more logical to write chgrp root file than to assume that root group is number zero
              – spaceman117X
              Aug 22 at 6:21













            up vote
            1
            down vote










            up vote
            1
            down vote









            Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:



            # touch testfile
            # chgrp 135543 testfile
            # ls -l testfile
            -rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
            # groupadd -g 135543 testgroup
            # ls -l testfile
            -rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile





            share|improve this answer














            Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:



            # touch testfile
            # chgrp 135543 testfile
            # ls -l testfile
            -rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
            # groupadd -g 135543 testgroup
            # ls -l testfile
            -rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 21 at 17:42

























            answered Aug 21 at 16:09









            Alexander

            78913




            78913











            • "Something". Fixed.
              – Alexander
              Aug 21 at 17:42










            • Yes, In my (beginners) opinion it is more logical to write chgrp root file than to assume that root group is number zero
              – spaceman117X
              Aug 22 at 6:21

















            • "Something". Fixed.
              – Alexander
              Aug 21 at 17:42










            • Yes, In my (beginners) opinion it is more logical to write chgrp root file than to assume that root group is number zero
              – spaceman117X
              Aug 22 at 6:21
















            "Something". Fixed.
            – Alexander
            Aug 21 at 17:42




            "Something". Fixed.
            – Alexander
            Aug 21 at 17:42












            Yes, In my (beginners) opinion it is more logical to write chgrp root file than to assume that root group is number zero
            – spaceman117X
            Aug 22 at 6:21





            Yes, In my (beginners) opinion it is more logical to write chgrp root file than to assume that root group is number zero
            – spaceman117X
            Aug 22 at 6:21











            up vote
            0
            down vote













            0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.






            share|improve this answer
























              up vote
              0
              down vote













              0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.






                share|improve this answer












                0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 21 at 15:37









                Rituraj

                9818




                9818



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463890%2fwhat-chgrp-0-do%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?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay