Today I wanted to mount a directory that belongs to Bob in Alice's home directory while giving Alice full permissions. This is how I found out about Bindfs. I'll get straight to what I was trying to do with the hope that this will help someone out there.
To install Bindfs:
apt install bindfs
Let's say we want to mount the directory /home/bob/share which belongs to Bob in Alice's home under the directory called bobs_share. We'll create the directory and then use bindfs to mount it. That's all.
mkdir /home/alice/bobs_share/ bindfs -u alice -g alice /home/bob/share/ /home/alice/bobs_share/
Alice now has full ownership of /home/alice/bobs_share/. However, new files created by Alice will be owned by Alice, visible in both her mount as well as on the source directory, in Bob's home. We can make it so that files created by Alice belong to bob by adding the "--create-for-user" and "--create-for-group" options.
bindfs -u alice -g alice --create-for-user=bob --create-for-group=bob /home/bob/share/ /home/alice/bobs_share/
You can also use /etc/fstab to mount the directy, here's the syntax for the options we've used above:
bindfs#/home/bob/share /home/alice/bobs_share fuse force-user=alice,force-group=alice,create-for-user=bob,create-for-group=bob 0 0