Is there a linux vfs tool that allows bind a directory in different location (like mount --bind) in user space?

The parrot program can do what you ask for: intercept system calls and redirect certain paths (e.g., all paths starting with /anonftp are remapped to transparently access remote files over FTP). It also runs entirely in userspace.

However, despite an impressive array of common and uncommon network protocols, parrot does not have any module to do simple filesystem->filesystem rewriting like you ask for. That should be quite simple to add, if you know some C language programming.

Alternatively, bindfs (which runs on top of FUSE), works like a mount --bind in userspace. (But this goes in the reverse direction relative to re-directing /home to /fake-home as you mention in your question.)


You can use PRoot almost the same way as in your example:

proot -b /fake-home:/home ls /home

Unlike BindFS/FUSE, PRoot is able to bind over files and directories you don't own.