Sharing a local directory between local users with full permissions

file-sharingfilesmountpermissions

How do you share a directory

/home/shared

between two users "eris" and "discordia" such that both can access the directory in their respective home directory, e.g.

/home/eris/shared

and

/home/discordia/shared

and both have full recursive read and write permission on the respective directory? The directories should lie on the same filesystem.

  • I tried using bind mounts and ACLs but these do not work well when moving (and copying?) files into the shared directory, in which case the default ACL will not be applied and the files will keep their original permissions instead,
  • The same holds for using the setguid flag,
  • bindfs with the "mirror" option does what I am looking for, but at the cost of dramatically poor performance, as shown by Guy Paddock.
  • setting the global umask to 002 is not an option,
  • neither is using vfat.

Best Answer

The methods you've mentioned are how I would've attempted to do it, in particular ACLs using setfacl to do it. I'd try and set the ACL at the top and make it so that it's recursively applied, but this would not protect files/dirs that are moved into this directory which are lacking it, I believe.

You could use something like incron to run a script anytime new directories or files are introduced into this "shared" directory via a move, and apply the necessary ACLs using setfacl if they're missing.