How can I recursively change the owner of a directory to the user nobody in linux











up vote
12
down vote

favorite
3












I would like to change the owner of a directory and all files and directories below it to the user nobody.



I have a /parent_dir with owner root. I want to change the owner to nobody (system user) recursively.










share|improve this question















migrated from stackoverflow.com Feb 23 '11 at 0:58


This question came from our site for professional and enthusiast programmers.



















    up vote
    12
    down vote

    favorite
    3












    I would like to change the owner of a directory and all files and directories below it to the user nobody.



    I have a /parent_dir with owner root. I want to change the owner to nobody (system user) recursively.










    share|improve this question















    migrated from stackoverflow.com Feb 23 '11 at 0:58


    This question came from our site for professional and enthusiast programmers.

















      up vote
      12
      down vote

      favorite
      3









      up vote
      12
      down vote

      favorite
      3






      3





      I would like to change the owner of a directory and all files and directories below it to the user nobody.



      I have a /parent_dir with owner root. I want to change the owner to nobody (system user) recursively.










      share|improve this question















      I would like to change the owner of a directory and all files and directories below it to the user nobody.



      I have a /parent_dir with owner root. I want to change the owner to nobody (system user) recursively.







      linux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 25 '12 at 11:28









      Paul

      47.6k13119146




      47.6k13119146










      asked Feb 22 '11 at 17:33







      jeny











      migrated from stackoverflow.com Feb 23 '11 at 0:58


      This question came from our site for professional and enthusiast programmers.






      migrated from stackoverflow.com Feb 23 '11 at 0:58


      This question came from our site for professional and enthusiast programmers.
























          4 Answers
          4






          active

          oldest

          votes

















          up vote
          22
          down vote













          Like this:



          sudo chown -R nobody /parent_dir





          share|improve this answer




























            up vote
            4
            down vote













            You may change the owner of the directory recursively using the following command. -R stands for recursive.



            chown -R ownername foldername


            You can also change the owner and group of the directory recursively using the following command.



            chown -R ownername:groupname foldername


            For more details refer this.






            share|improve this answer






























              up vote
              1
              down vote













              By using the -R command line parameter of chown.



              chown -R nobody /parent_dir





              share|improve this answer






























                up vote
                1
                down vote













                Just as an alternative to the other answers:



                sudo find /parent_dir -exec chown nobody {} ;


                if you only want to change files you could use -type f or -type d for directories. comes in handy, when you want to chmod stuff.






                share|improve this answer























                • another thing you can do here is restrict it to only change files from one particular owner to another. If only a few files are root owned that can save a lot of metadata writes.
                  – Bron Gondwana
                  Jul 25 '12 at 11:57











                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "3"
                };
                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: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f249170%2fhow-can-i-recursively-change-the-owner-of-a-directory-to-the-user-nobody-in-linu%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown
























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                22
                down vote













                Like this:



                sudo chown -R nobody /parent_dir





                share|improve this answer

























                  up vote
                  22
                  down vote













                  Like this:



                  sudo chown -R nobody /parent_dir





                  share|improve this answer























                    up vote
                    22
                    down vote










                    up vote
                    22
                    down vote









                    Like this:



                    sudo chown -R nobody /parent_dir





                    share|improve this answer












                    Like this:



                    sudo chown -R nobody /parent_dir






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 22 '11 at 17:35









                    shellholic

                    6,2571108




                    6,2571108
























                        up vote
                        4
                        down vote













                        You may change the owner of the directory recursively using the following command. -R stands for recursive.



                        chown -R ownername foldername


                        You can also change the owner and group of the directory recursively using the following command.



                        chown -R ownername:groupname foldername


                        For more details refer this.






                        share|improve this answer



























                          up vote
                          4
                          down vote













                          You may change the owner of the directory recursively using the following command. -R stands for recursive.



                          chown -R ownername foldername


                          You can also change the owner and group of the directory recursively using the following command.



                          chown -R ownername:groupname foldername


                          For more details refer this.






                          share|improve this answer

























                            up vote
                            4
                            down vote










                            up vote
                            4
                            down vote









                            You may change the owner of the directory recursively using the following command. -R stands for recursive.



                            chown -R ownername foldername


                            You can also change the owner and group of the directory recursively using the following command.



                            chown -R ownername:groupname foldername


                            For more details refer this.






                            share|improve this answer














                            You may change the owner of the directory recursively using the following command. -R stands for recursive.



                            chown -R ownername foldername


                            You can also change the owner and group of the directory recursively using the following command.



                            chown -R ownername:groupname foldername


                            For more details refer this.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 14 at 10:43

























                            answered Oct 14 '14 at 5:46









                            Mahendran Sakkarai

                            1414




                            1414






















                                up vote
                                1
                                down vote













                                By using the -R command line parameter of chown.



                                chown -R nobody /parent_dir





                                share|improve this answer



























                                  up vote
                                  1
                                  down vote













                                  By using the -R command line parameter of chown.



                                  chown -R nobody /parent_dir





                                  share|improve this answer

























                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote









                                    By using the -R command line parameter of chown.



                                    chown -R nobody /parent_dir





                                    share|improve this answer














                                    By using the -R command line parameter of chown.



                                    chown -R nobody /parent_dir






                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Jul 10 '11 at 5:09









                                    3498DB

                                    15.6k114761




                                    15.6k114761










                                    answered Feb 22 '11 at 17:35









                                    filmor

                                    1165




                                    1165






















                                        up vote
                                        1
                                        down vote













                                        Just as an alternative to the other answers:



                                        sudo find /parent_dir -exec chown nobody {} ;


                                        if you only want to change files you could use -type f or -type d for directories. comes in handy, when you want to chmod stuff.






                                        share|improve this answer























                                        • another thing you can do here is restrict it to only change files from one particular owner to another. If only a few files are root owned that can save a lot of metadata writes.
                                          – Bron Gondwana
                                          Jul 25 '12 at 11:57















                                        up vote
                                        1
                                        down vote













                                        Just as an alternative to the other answers:



                                        sudo find /parent_dir -exec chown nobody {} ;


                                        if you only want to change files you could use -type f or -type d for directories. comes in handy, when you want to chmod stuff.






                                        share|improve this answer























                                        • another thing you can do here is restrict it to only change files from one particular owner to another. If only a few files are root owned that can save a lot of metadata writes.
                                          – Bron Gondwana
                                          Jul 25 '12 at 11:57













                                        up vote
                                        1
                                        down vote










                                        up vote
                                        1
                                        down vote









                                        Just as an alternative to the other answers:



                                        sudo find /parent_dir -exec chown nobody {} ;


                                        if you only want to change files you could use -type f or -type d for directories. comes in handy, when you want to chmod stuff.






                                        share|improve this answer














                                        Just as an alternative to the other answers:



                                        sudo find /parent_dir -exec chown nobody {} ;


                                        if you only want to change files you could use -type f or -type d for directories. comes in handy, when you want to chmod stuff.







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Jul 25 '12 at 11:56

























                                        answered Jul 25 '12 at 11:50









                                        Baarn

                                        5,25652659




                                        5,25652659












                                        • another thing you can do here is restrict it to only change files from one particular owner to another. If only a few files are root owned that can save a lot of metadata writes.
                                          – Bron Gondwana
                                          Jul 25 '12 at 11:57


















                                        • another thing you can do here is restrict it to only change files from one particular owner to another. If only a few files are root owned that can save a lot of metadata writes.
                                          – Bron Gondwana
                                          Jul 25 '12 at 11:57
















                                        another thing you can do here is restrict it to only change files from one particular owner to another. If only a few files are root owned that can save a lot of metadata writes.
                                        – Bron Gondwana
                                        Jul 25 '12 at 11:57




                                        another thing you can do here is restrict it to only change files from one particular owner to another. If only a few files are root owned that can save a lot of metadata writes.
                                        – Bron Gondwana
                                        Jul 25 '12 at 11:57


















                                         

                                        draft saved


                                        draft discarded



















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f249170%2fhow-can-i-recursively-change-the-owner-of-a-directory-to-the-user-nobody-in-linu%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Plaza Victoria

                                        Brian Clough

                                        Cáceres