Results 1 to 3 of 3

Thread: sharing home folder with other group users

  1. #1
    Join Date
    Apr 2013
    Beans
    7

    sharing home folder with other group users

    Is it possible to create a folder/files for a group of users, and have it visible to all in the group including root, In the GUI screen?

  2. #2
    Join Date
    Dec 2009
    Beans
    5,304

    Re: sharing home folder with other group users

    It depends on how you are going to use the shared directory.

    The classic Linux way of doing this sort of thing goes something like this:

    [1] Create the shared folder:
    Code:
    sudo mkdir /home/Shared
    [2] Create the new user's group:
    Code:
    sudo groupadd newgroup
    [3] Change ownership of the shared folder to the new group:
    Code:
    sudo chown :newgroup /home/Shared
    [4] Add your desired users to that group:
    Code:
    sudo gpasswd -a morbius newgroup
    Now you have some decisions to make about what you want those users to be able to do:

    [a] All group users can add to and delete from the folder and can read and but not write to each others files:
    Code:
    sudo chmod 0770 /home/Shared
    [b] Same as above but only the owner of the file can delete it:
    Code:
    sudo chmod 1770 /home/Shared
    [c] All group users can add to and delete from the folder and can read and write to each other's files:
    Code:
    sudo chmod 2770 /home/Shared
    [d] Same as [c] except only the owner of the file can delete it:
    Code:
    sudo chmod 3770 /home/Shared
    A "1" in the first position of the chmod command is the "sticky bit" which prevents deletion of a file to anyone other than the owner.
    A "2" in the first position of the chmod command is the "setgid bit" which forces all new or copied files to have the group of that folder.
    A "3" in the first position of the chmod command is the combination of the sticky (1) & setgid (+2) bits.

    *** There is one caveat to all this as far as the setgid bit is concerned. All new files created in and any files copied to that folder will in fact inherit the group of the folder. But not files moved to that folder. Moved files retain the ownership from wherever they were moved from. One way to get past this problem is to use bindfs.

    *** And in turn one caveat to bindfs is that it has no concept of a "sticky bit".
    Last edited by Morbius1; April 24th, 2013 at 01:01 PM. Reason: Even with an embedded spell checker is still can't get it right

  3. #3
    Join Date
    Sep 2012
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sharing home folder with other group users

    +1

    The only bit missing is what to do about users not in the group. You obviously don't want to let them change anything but you may want to let them read what's there

    All the examples above don't give them any access but thats easy to change if you want. For example

    [a] All group users can add to and delete from the folder and can read and but not write to each others files:
    Code:
    sudo chmod 0770 /home/Shared
    keeps everyone else out, but

    Code:
    sudo chmod 0775 /home/Shared
    Gives people outside the group read only access

    If you want other users to have read only access just change the final 0 in the chmod to a 5. If you don't use the commands as given

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •