mpartel / bindfs

Mount a directory elsewhere with changed permissions.
https://bindfs.org/
GNU General Public License v2.0
443 stars 64 forks source link

How to use bindfs in fstab with osxfuse+macOS Catalina #87

Open x4base opened 4 years ago

x4base commented 4 years ago

Hi, here is my environment: bindfs 1.14.7 installed with brew osxfuse 3.11.0 installed using official dmg file macOS 10.15.5 Catalina

Now sudo bindfs ~/fake_root_dir/projects/ /projects_test/ works for me, but I want to use /etc/fstab to mount it on boot. So in /etc/fstab, I added: /Users/x4base/fake_root_dir/projects/ /projects_test fuse.bindfs perms=0700,mirror-only=x4base,local,allow_other,extended_security,noappledouble 0 0

But the result is:

sudo mount -a
mount_apfs: volume could not be mounted: Operation not permitted
mount: / failed with 77
mount: exec /Library/Filesystems/fuse.bindfs.fs/Contents/Resources/mount_fuse.bindfs for /projects_test: No such file or directory
mount: /projects_test failed with 72

Do I really need the file /Library/Filesystems/fuse.bindfs.fs/Contents/Resources/mount_fuse.bindfs ? Where can I get it?

In osxfuse/osxfuse#194, someone says I can do sudo ln -s /usr/local/bin/bindfs /sbin/mount_fuse.bindfs, but the macOS now doesn't allow any modification to /sbin.

What is the proper way to solve it? Thanks!

x4base commented 4 years ago

OK, I found out that instead of using fstab, I can do auto-mount using LaunchDaemons like this:

/Library/launchDaemons/org.user.bindfs.projects.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>org.user.bindfs.projects</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/bin/bindfs</string>
                <string>/Users/x4base/fake_root_dir/projects/</string>
                <string>/projects</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/tmp/org.user.bindfs.projects.err</string>
        <key>StandardOutPath</key>
        <string>/tmp/org.user.bindfs.projects.out</string>
        <key>WatchPaths</key>
        <array>
                <string>/projects</string>
        </array>
</dict>
</plist>

then sudo launchctl load -w /Library/launchDaemons/org.user.bindfs.projects.plist

Then it works as expected.

If anyone knows how to do it in the fstab way, the answer is still welcomed. You can close this issue if you like. Thanks

mpartel commented 4 years ago

Thanks for following up with the workaround!

I don't test on MacOS very often or very thoroughly, so I'm not great at keeping up with all the new limitations and backwards-incompatibilities Apple likes to cook up :/

I'll leave this issue open for visibility. At some point I should probably document MacOS-specifics better on the website/readme/man-page.

x4base commented 4 years ago

That would be great, thanks!