Truly share a folder with multiple users on a computer

I have a folder in my home directory that I want to be truly shared between all users on the same computer.

So, I set the permission to be 777. Now, all users can access it and can create, ,edit, delete files in it.

However, I do not have write access to files created by other users.

How do I ensure that all files (existing as well as newly created/ copied) have rwx access to all users?


I suggest you use bindfs.

bindfs allow multiple local users to read and write (create, delete, rename, modify...) all files (including newly created ones) from a shared directory and its subdirectories.

You can specify users by user name or group, it is very flexible.

The basic syntax (from the wiki page) is:

  • Creating the shared directory

e.g. in the /home directory:

sudo mkdir /home/shared

NOTE: If the directory already exist skip this step.

Allow only root to access it, we will set the permissions later with bindfs:

sudo chown root: /home/shared
sudo chmod 0700 /home/shared
  • Setting the permissions with bindfs

Now use the bindfs command to mount the shared directory with altered permissions. Syntax of the command:

bindfs [options] dir mountpoint

Example:

sudo bindfs -o perms=0700,mirror-only=user1:user2:user3 /home/shared /home/shared
  • Options explained:

perms=0700 sets the permissions to 0700 (read/write for the owner, none for the group and other)

mirror-only=user1:user2:user3 user1, user2 and user3 will see itself as the owner of the files (user names are separated by a colon).

To automatically mount at boot, use fstab . Open fstab for editing with sudo nano /etc/fstab and add a line

  • fstab example:

bindfs#/home/shared /home/shared fuse perms=0700,mirror-only=user1:user2:user3 0 0

See - Ubuntu wiki bindfs for group options and additional details.


The other users have to set the permissions to rwx for you.

If you don't want to install a new software the others users should do this (one of many options):

  1. Set the Access to Folder permission for other users to create & delete files. Do the same with Access to Files permission:

View

  1. And then push on Apply Permissions to the Files:

enter image description here