mount –bind Other User as Myself

bind-mountmount

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.

Best Answer

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.

bindfs -u cqqrstoo ~bob/stuff ~cqqrstoo/bobs-stuff

In /etc/fstab, that would translate to:

bindfs#/home/bob/stuff /home/cqqrstoo/bobs-stuff fuse force-user=cqqrstoo 0 0
Related Question