Allowing a group Read-Write Access to a directory











up vote
28
down vote

favorite
7












I have two users, user1 and user2, that are both members of groupA. user2 has a folder in their home directory called folderA. If they wish to allow read-write-execute permissions for all members of groupA, how would they do this?



What if folderA contains many files and additional folders that also need to have read-write-execute permission?



Information regarding groups is a little 'spotty' across the web, so I am putting my question here in the hope someone posts a clear answer that might help others out too.



Thanks!










share|improve this question


























    up vote
    28
    down vote

    favorite
    7












    I have two users, user1 and user2, that are both members of groupA. user2 has a folder in their home directory called folderA. If they wish to allow read-write-execute permissions for all members of groupA, how would they do this?



    What if folderA contains many files and additional folders that also need to have read-write-execute permission?



    Information regarding groups is a little 'spotty' across the web, so I am putting my question here in the hope someone posts a clear answer that might help others out too.



    Thanks!










    share|improve this question
























      up vote
      28
      down vote

      favorite
      7









      up vote
      28
      down vote

      favorite
      7






      7





      I have two users, user1 and user2, that are both members of groupA. user2 has a folder in their home directory called folderA. If they wish to allow read-write-execute permissions for all members of groupA, how would they do this?



      What if folderA contains many files and additional folders that also need to have read-write-execute permission?



      Information regarding groups is a little 'spotty' across the web, so I am putting my question here in the hope someone posts a clear answer that might help others out too.



      Thanks!










      share|improve this question













      I have two users, user1 and user2, that are both members of groupA. user2 has a folder in their home directory called folderA. If they wish to allow read-write-execute permissions for all members of groupA, how would they do this?



      What if folderA contains many files and additional folders that also need to have read-write-execute permission?



      Information regarding groups is a little 'spotty' across the web, so I am putting my question here in the hope someone posts a clear answer that might help others out too.



      Thanks!







      permissions






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 26 '14 at 14:49









      WxPilot

      5082822




      5082822






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          42
          down vote



          accepted










          FolderA will first need to be part of groupA - the folder's owner or root can perform this operation



          chgrp groupA ./folderA



          Then groupA will need rwx permissions of the folder



          chmod g+rwx ./folderA



          There are options in the chgrp and chmod commands to recurse into the directory if required.






          share|improve this answer





















          • note: you should make sure that you can access intermediate directories too (+x might be enough).
            – jfs
            Aug 2 '16 at 9:55


















          up vote
          0
          down vote













          My own experience in this area here. Original how-to. Tested on Ubuntu 18.04.



          Allow to write in the system folder



          Give write permission to /etc/nginx/ folder.



          # Check 'webmasters' group doen't exist
          cat /etc/group | grep webmasters
          # Create 'webmasters' group
          sudo addgroup webmasters
          # Add users to 'webmasters' group
          sudo usermod -a -G webmasters username
          sudo usermod -a -G webmasters vozman
          sudo usermod -a -G webmasters romanroskach

          # Group assignment changes won't take effect
          # until the users log out and back in.

          # Create directory
          sudo mkdir /etc/nginx/
          # Check directory permissions
          ls -al /etc | grep nginx
          drwxr-xr-x 2 root root 4096 Dec 5 18:30 nginx

          # Change group owner of the directory
          sudo chgrp -R webmasters /etc/nginx/
          # Check that the group owner is changed
          ls -al /etc | grep nginx
          drwxr-xr-x 2 root webmasters 4096 Dec 5 18:30 nginx

          # Give write permission to the group
          sudo chmod -R g+w /etc/nginx/
          # Check
          ls -al /etc | grep nginx
          drwxrwxr-x 2 root webmasters 4096 Dec 5 18:30 nginx

          # Try to create file
          sudo -u username touch /etc/nginx/test.txt # should work
          sudo -u username touch /etc/test.txt # Permission denied


          Give write permission to /etc/systemd/system/ folder.



          # List ACLs
          getfacl /etc/systemd/system

          getfacl: Removing leading '/' from absolute path names
          # file: etc/systemd/system
          # owner: root
          # group: root
          user::rwx
          group::r-x
          other::r-x

          # Add 'webmasters' group to an ACL
          sudo setfacl -m g:webmasters:rwx /etc/systemd/system

          # Check
          getfacl /etc/systemd/system

          getfacl: Removing leading '/' from absolute path names
          # file: etc/systemd/system
          # owner: root
          # group: root
          user::rwx
          group::r-x
          group:webmasters:rwx
          mask::rwx
          other::r-x

          sudo -u username touch /etc/systemd/system/test.txt # should work
          sudo -u username touch /etc/systemd/test.txt # Permission denied





          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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%2faskubuntu.com%2fquestions%2f488485%2fallowing-a-group-read-write-access-to-a-directory%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            42
            down vote



            accepted










            FolderA will first need to be part of groupA - the folder's owner or root can perform this operation



            chgrp groupA ./folderA



            Then groupA will need rwx permissions of the folder



            chmod g+rwx ./folderA



            There are options in the chgrp and chmod commands to recurse into the directory if required.






            share|improve this answer





















            • note: you should make sure that you can access intermediate directories too (+x might be enough).
              – jfs
              Aug 2 '16 at 9:55















            up vote
            42
            down vote



            accepted










            FolderA will first need to be part of groupA - the folder's owner or root can perform this operation



            chgrp groupA ./folderA



            Then groupA will need rwx permissions of the folder



            chmod g+rwx ./folderA



            There are options in the chgrp and chmod commands to recurse into the directory if required.






            share|improve this answer





















            • note: you should make sure that you can access intermediate directories too (+x might be enough).
              – jfs
              Aug 2 '16 at 9:55













            up vote
            42
            down vote



            accepted







            up vote
            42
            down vote



            accepted






            FolderA will first need to be part of groupA - the folder's owner or root can perform this operation



            chgrp groupA ./folderA



            Then groupA will need rwx permissions of the folder



            chmod g+rwx ./folderA



            There are options in the chgrp and chmod commands to recurse into the directory if required.






            share|improve this answer












            FolderA will first need to be part of groupA - the folder's owner or root can perform this operation



            chgrp groupA ./folderA



            Then groupA will need rwx permissions of the folder



            chmod g+rwx ./folderA



            There are options in the chgrp and chmod commands to recurse into the directory if required.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 26 '14 at 15:02









            Charles Green

            13k73557




            13k73557












            • note: you should make sure that you can access intermediate directories too (+x might be enough).
              – jfs
              Aug 2 '16 at 9:55


















            • note: you should make sure that you can access intermediate directories too (+x might be enough).
              – jfs
              Aug 2 '16 at 9:55
















            note: you should make sure that you can access intermediate directories too (+x might be enough).
            – jfs
            Aug 2 '16 at 9:55




            note: you should make sure that you can access intermediate directories too (+x might be enough).
            – jfs
            Aug 2 '16 at 9:55












            up vote
            0
            down vote













            My own experience in this area here. Original how-to. Tested on Ubuntu 18.04.



            Allow to write in the system folder



            Give write permission to /etc/nginx/ folder.



            # Check 'webmasters' group doen't exist
            cat /etc/group | grep webmasters
            # Create 'webmasters' group
            sudo addgroup webmasters
            # Add users to 'webmasters' group
            sudo usermod -a -G webmasters username
            sudo usermod -a -G webmasters vozman
            sudo usermod -a -G webmasters romanroskach

            # Group assignment changes won't take effect
            # until the users log out and back in.

            # Create directory
            sudo mkdir /etc/nginx/
            # Check directory permissions
            ls -al /etc | grep nginx
            drwxr-xr-x 2 root root 4096 Dec 5 18:30 nginx

            # Change group owner of the directory
            sudo chgrp -R webmasters /etc/nginx/
            # Check that the group owner is changed
            ls -al /etc | grep nginx
            drwxr-xr-x 2 root webmasters 4096 Dec 5 18:30 nginx

            # Give write permission to the group
            sudo chmod -R g+w /etc/nginx/
            # Check
            ls -al /etc | grep nginx
            drwxrwxr-x 2 root webmasters 4096 Dec 5 18:30 nginx

            # Try to create file
            sudo -u username touch /etc/nginx/test.txt # should work
            sudo -u username touch /etc/test.txt # Permission denied


            Give write permission to /etc/systemd/system/ folder.



            # List ACLs
            getfacl /etc/systemd/system

            getfacl: Removing leading '/' from absolute path names
            # file: etc/systemd/system
            # owner: root
            # group: root
            user::rwx
            group::r-x
            other::r-x

            # Add 'webmasters' group to an ACL
            sudo setfacl -m g:webmasters:rwx /etc/systemd/system

            # Check
            getfacl /etc/systemd/system

            getfacl: Removing leading '/' from absolute path names
            # file: etc/systemd/system
            # owner: root
            # group: root
            user::rwx
            group::r-x
            group:webmasters:rwx
            mask::rwx
            other::r-x

            sudo -u username touch /etc/systemd/system/test.txt # should work
            sudo -u username touch /etc/systemd/test.txt # Permission denied





            share|improve this answer

























              up vote
              0
              down vote













              My own experience in this area here. Original how-to. Tested on Ubuntu 18.04.



              Allow to write in the system folder



              Give write permission to /etc/nginx/ folder.



              # Check 'webmasters' group doen't exist
              cat /etc/group | grep webmasters
              # Create 'webmasters' group
              sudo addgroup webmasters
              # Add users to 'webmasters' group
              sudo usermod -a -G webmasters username
              sudo usermod -a -G webmasters vozman
              sudo usermod -a -G webmasters romanroskach

              # Group assignment changes won't take effect
              # until the users log out and back in.

              # Create directory
              sudo mkdir /etc/nginx/
              # Check directory permissions
              ls -al /etc | grep nginx
              drwxr-xr-x 2 root root 4096 Dec 5 18:30 nginx

              # Change group owner of the directory
              sudo chgrp -R webmasters /etc/nginx/
              # Check that the group owner is changed
              ls -al /etc | grep nginx
              drwxr-xr-x 2 root webmasters 4096 Dec 5 18:30 nginx

              # Give write permission to the group
              sudo chmod -R g+w /etc/nginx/
              # Check
              ls -al /etc | grep nginx
              drwxrwxr-x 2 root webmasters 4096 Dec 5 18:30 nginx

              # Try to create file
              sudo -u username touch /etc/nginx/test.txt # should work
              sudo -u username touch /etc/test.txt # Permission denied


              Give write permission to /etc/systemd/system/ folder.



              # List ACLs
              getfacl /etc/systemd/system

              getfacl: Removing leading '/' from absolute path names
              # file: etc/systemd/system
              # owner: root
              # group: root
              user::rwx
              group::r-x
              other::r-x

              # Add 'webmasters' group to an ACL
              sudo setfacl -m g:webmasters:rwx /etc/systemd/system

              # Check
              getfacl /etc/systemd/system

              getfacl: Removing leading '/' from absolute path names
              # file: etc/systemd/system
              # owner: root
              # group: root
              user::rwx
              group::r-x
              group:webmasters:rwx
              mask::rwx
              other::r-x

              sudo -u username touch /etc/systemd/system/test.txt # should work
              sudo -u username touch /etc/systemd/test.txt # Permission denied





              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                My own experience in this area here. Original how-to. Tested on Ubuntu 18.04.



                Allow to write in the system folder



                Give write permission to /etc/nginx/ folder.



                # Check 'webmasters' group doen't exist
                cat /etc/group | grep webmasters
                # Create 'webmasters' group
                sudo addgroup webmasters
                # Add users to 'webmasters' group
                sudo usermod -a -G webmasters username
                sudo usermod -a -G webmasters vozman
                sudo usermod -a -G webmasters romanroskach

                # Group assignment changes won't take effect
                # until the users log out and back in.

                # Create directory
                sudo mkdir /etc/nginx/
                # Check directory permissions
                ls -al /etc | grep nginx
                drwxr-xr-x 2 root root 4096 Dec 5 18:30 nginx

                # Change group owner of the directory
                sudo chgrp -R webmasters /etc/nginx/
                # Check that the group owner is changed
                ls -al /etc | grep nginx
                drwxr-xr-x 2 root webmasters 4096 Dec 5 18:30 nginx

                # Give write permission to the group
                sudo chmod -R g+w /etc/nginx/
                # Check
                ls -al /etc | grep nginx
                drwxrwxr-x 2 root webmasters 4096 Dec 5 18:30 nginx

                # Try to create file
                sudo -u username touch /etc/nginx/test.txt # should work
                sudo -u username touch /etc/test.txt # Permission denied


                Give write permission to /etc/systemd/system/ folder.



                # List ACLs
                getfacl /etc/systemd/system

                getfacl: Removing leading '/' from absolute path names
                # file: etc/systemd/system
                # owner: root
                # group: root
                user::rwx
                group::r-x
                other::r-x

                # Add 'webmasters' group to an ACL
                sudo setfacl -m g:webmasters:rwx /etc/systemd/system

                # Check
                getfacl /etc/systemd/system

                getfacl: Removing leading '/' from absolute path names
                # file: etc/systemd/system
                # owner: root
                # group: root
                user::rwx
                group::r-x
                group:webmasters:rwx
                mask::rwx
                other::r-x

                sudo -u username touch /etc/systemd/system/test.txt # should work
                sudo -u username touch /etc/systemd/test.txt # Permission denied





                share|improve this answer












                My own experience in this area here. Original how-to. Tested on Ubuntu 18.04.



                Allow to write in the system folder



                Give write permission to /etc/nginx/ folder.



                # Check 'webmasters' group doen't exist
                cat /etc/group | grep webmasters
                # Create 'webmasters' group
                sudo addgroup webmasters
                # Add users to 'webmasters' group
                sudo usermod -a -G webmasters username
                sudo usermod -a -G webmasters vozman
                sudo usermod -a -G webmasters romanroskach

                # Group assignment changes won't take effect
                # until the users log out and back in.

                # Create directory
                sudo mkdir /etc/nginx/
                # Check directory permissions
                ls -al /etc | grep nginx
                drwxr-xr-x 2 root root 4096 Dec 5 18:30 nginx

                # Change group owner of the directory
                sudo chgrp -R webmasters /etc/nginx/
                # Check that the group owner is changed
                ls -al /etc | grep nginx
                drwxr-xr-x 2 root webmasters 4096 Dec 5 18:30 nginx

                # Give write permission to the group
                sudo chmod -R g+w /etc/nginx/
                # Check
                ls -al /etc | grep nginx
                drwxrwxr-x 2 root webmasters 4096 Dec 5 18:30 nginx

                # Try to create file
                sudo -u username touch /etc/nginx/test.txt # should work
                sudo -u username touch /etc/test.txt # Permission denied


                Give write permission to /etc/systemd/system/ folder.



                # List ACLs
                getfacl /etc/systemd/system

                getfacl: Removing leading '/' from absolute path names
                # file: etc/systemd/system
                # owner: root
                # group: root
                user::rwx
                group::r-x
                other::r-x

                # Add 'webmasters' group to an ACL
                sudo setfacl -m g:webmasters:rwx /etc/systemd/system

                # Check
                getfacl /etc/systemd/system

                getfacl: Removing leading '/' from absolute path names
                # file: etc/systemd/system
                # owner: root
                # group: root
                user::rwx
                group::r-x
                group:webmasters:rwx
                mask::rwx
                other::r-x

                sudo -u username touch /etc/systemd/system/test.txt # should work
                sudo -u username touch /etc/systemd/test.txt # Permission denied






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 5 at 17:46









                foo bar

                1114




                1114






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f488485%2fallowing-a-group-read-write-access-to-a-directory%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

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido