Search code examples
macosfilesystemsmounted-volumesmacfuse

How to deny user access MacFuse file system by the really path


I've developed a simple MacFuse filesystem based on the example project LoopbackFS, then I mount the fuse file system to folder lookB, which located under path /Users/eren/lookB.

Now we have two ways to access the folder lookB, one way is directly access path /Users/eren/lookB by Finder, another way is accessing the fuse mount path, such as /volumes/loop/FuseDemo.

I tried these two ways to access the contents under folder lookB, but found that when I directly use path /Users/eren/lookB, the MacFuse filesystem callback never called. I think it's because Finder didn't use my FuseDemo filesystem.

Is there a way to deny Finder access my MacFuse filesystem by path like /Users/eren/lookB? Or is there any way to hide the folder in path /Users/eren/lookB?

What I want is that the user can only access my fuse filesystem by the mounted point path /volumes/loop/FuseDemo, and I tried may ways, such as hide the FuseDemo folder by return empty from contentsOfDirectoryAtPath callback, create a virtual folder under Fuse filesystem by return the virtual folder name from contentsOfDirectoryAtPath callback, but none of them helps.


Solution

  • After several days research, finally I found a way to deny Finder open the folder from the really path. Just use the Endpoint system extension, and deny all ES_EVENT_TYPE_AUTH_READDIR when the msg->event.readdir.target->path.data is my folder path. Although this makes it impossible for me to see these files under my filesystem, but I can still use file system API such as open(), createFile() to do some operations in the folder.