I want to access different file when different users access the samefilepath. For example there is a file path /path/a.txt in linux, ifuser1 access /path/a.txt it actually accesses /user1/a.txt; if user2access /path/a.txt it actually accesses /user2/a.txtAny help is much appreciated. Thanks !
is there a filesystem that a same filepath diverted to different file when different users access it?
filesystems
Off the top of my head I can think of 4 ways of doing this, but I wouldn't recommend any of them!Use Linux namespaces; inside each per-user namespace bind-mount the per-user file over the top of the base file.Create a per-user chroot environment with the base file symlink'd to the target fileRun a FUSE based filesystem and mount this over the top of the base fileHave the base file be a named pipe with a daemon process handling read/write to the per-user file.But all of these are complicated to setup and fragile and I wouldn't recommend them.  I'm not going into any more depth in how to implement this because if you can't build it then you won't be able to fix it WHEN it breaks!In general you should work around the problem in another way in your code (eg use environment variables).