22

I'm using fstab to bind a folder that belongs to another user in one of my own directories. I know that I can map users when I mount an SSHFS, I've been doing some research and I can't find a mount --bind equivalent.

Is there any way I can mount another user's folder and files as my own?

Update: It doesn't necessarily have to be mount --bind. It just has to do something similar while mapping users, and can be done on startup.

Niko
  • 555

1 Answers1

30

You can't do that with the Linux bind mount kernel feature. But you can do it with the FUSE filesystem bindfs. Bindfs is slower than bind mounts and doesn't pass extended attributes, but on the flip side, it can be used by non-root users and on Unix variants other than Linux, and most importantly for you, allows simple transformations of ownership and permissions.

Assuming that your user name is andy and the other user is bob:

bindfs -u andy /home/bob/stuff /home/andy/bobs-stuff

In /etc/fstab, that would translate to:

bindfs#/home/bob/stuff /home/andy/bobs-stuff fuse force-user=andy 0 0