I will offer two methods in this HowTo.
Method A: Using traditional linux ownership and permissions ( the first post in this topic )
Method B: Using Bindfs ( the second post in this topic )
Method A: Using Linux Permissions
Creating a "shared" local directory between multiple local users depends on your definition of "shared". The following are examples of options on how you would set up a shared directory accessible by local users.
I'm going to start by creating the directory to be shared:
Code: Select all
sudo mkdir /home/Shared
[1] All users can add to and delete from the folder and can read but not write to each others files:
Code: Select all
sudo chmod 0777 /home/Shared
Code: Select all
sudo chmod 1777 /home/Shared
[3] All users can add to and delete from the folder and can read and write to every file:
Code: Select all
sudo chown :plugdev /home/Shared
sudo chmod 2775 /home/Shared
Code: Select all
sudo gpasswd -a mary plugdev
Note2: The "2" in "chmod 2775" is the setgid bit. All files saved to a directory with that bit set will inherit the group of the directory.
Note3: Changing the global umask from 022 to 002 will force every saved folder / file to save with permissions of 775 / 664. So all users who are members of the group will have read / write access to all new folders / files.
[4] All users can add to but can only delete files they own and can read and write to every file:
Same as [3] above except "sudo chmod 2775 /home/Shared" is changed to this:
Code: Select all
sudo chmod 3775 /home/Shared
[5] Only some users can add and delete from the folder and can read and write to every file:
Code: Select all
sudo groupadd special
sudo gpasswd -a mary special
sudo chown :special /home/Shared
sudo chmod 2770 /home/Shared
[6] Only some users can add to but can only delete files they own and can read and write to every file
Same as [5] except "sudo chmod 2770 /home/Shared" is changed to this:
Code: Select all
sudo chmod 3770 /home/Shared