By Unknown

Share a folder among various local users

This article describes how to share a folder among various users in the same computer? It's a sort of "Public Folder".

We will install and use an app called bindfs. We will also need configure the shared directory. For this you will need to type some commands in a terminal window and edit one system file, so here we go.

Install bindfs
Open a terminal window (you can do this by pressing Ctrl+Alt+T), and type the following command (the sudo command will ask you for your password):
sudo apt-get install bindfs

Create the folder
Simply type the following commands in your terminal. (In this example the shared dir will be located at /srv/shared, you can use any name, but usually it's a good idea to keep this dir inside /srv):
sudo mkdir /srv/shared sudo chown root: /srv/shared sudo chmod 0700 /srv/shared
NOTE: here you're creating the dir, giving the ownership to root and setting the permissions.

Tell the system to share this folder
Now we need to tell the system to “mount” this dir to be accessed by the users at boot time, so we will edit the file called /etc/fstab.
First backup it:
sudo cp /etc/fstab /etc/fstab.bak
And now we can edit it:
gksudo scratch-text-editor /etc/fstab
This command will open Scratch to edit the file. Add at the end the following line:
bindfs#/srv/shared /srv/shared fuse perms=0700,mirror-only=userA:userB 0 0

What does this line mean?

It tells the system to mount using bindfs the dir called /srv/shared in this same point (/div/shared), and give full access to users called userA and userB. Of course you must replace the userA and userB with your actual user names, and you can add more users by separating them with a colon. (userA:userB:userC:userD)

Reboot. Now you can log in as any of these users and navigate the dir with Files.

TIP
Once you navigate to the dir's upper level (in our example: /srv) with Files, you can drag and drop the dir on the left column under the Personal section. Now you will have a shortcut to access the shared folder.