trapexit / mergerfs

a featureful union filesystem
http://spawn.link
Other
4.03k stars 168 forks source link

Failure to mount with user_allow_other disabeld in fuse.conf #1273

Closed anthonyryan1 closed 8 months ago

anthonyryan1 commented 8 months ago

Describe the bug

After https://github.com/trapexit/mergerfs/commit/92ccfd3c89c80e274e8137a2d23ee8541ae5857d it's no longer possible to use mergerfs in environments where /etc/fuse.conf has user_alow_other disabled.

To Reproduce

  1. Edit /etc/fuse.conf and comment out the line user_allow_other.
  2. mkdir dir1:dir2 dir3
  3. mergerfs dir1:dir2 dir3

Error message:

fusermount: failed to chdir to mountpoint: Permission denied

Expected behavior

mergerfs should check the value in /etc/fuse.conf and only set that option if it's permitted on the system. It's better to lose allow_other in some contexts than to fail to work.

Additional context

It looks like we already have code for this in a fusermount.c. I'm not certain if that's a static dependency in the tree that we don't really modify, but it's a starting point.

trapexit commented 8 months ago

What is the usecase?

mergerfs must run as root to work properly. allow_other is required for it to be visible by any other user. If run as root the /etc/fuse.conf setting is not relevant. So I can optionally set allow_other but I would then just need to add a test to see if running as root and error out or log serious warnings that it probably won't work.

anthonyryan1 commented 8 months ago

The primary use case I've observed is people on shared hosting plans using it to merge slow & cheap cloud storage (often Google Drive) together with local storage for Plex servers.

It's a way to merge short term and long term storage together for them.

They don't have root, so mergerfs is used with user permissions only. I'm aware of nearly a hundred people running mergerfs for this precise use case, and (so far) the lack of root level permissions hasn't been a problem for any of them.

trapexit commented 8 months ago

mergerfs absolutely is written (and could ever only work properly) when run as root. It simply has ignored certain errors that allowed it to continue on when certain things failed. Some actions are impossible to do without root access. Those users just haven't done anything with perms to have noticed it.

I can rework it not to add if not root but I've already started putting in strong warnings about this situation because I've gotten plenty of people who tried running mergerfs as non-root and ran into issues and reported them as bugs.

anthonyryan1 commented 8 months ago

Fair enough. Closing this as an unsupported use case.

Thanks for your work on this project!

trapexit commented 8 months ago

As I said I can rework it to accommodate but it will spit out a warning to indicate it isn't technically supported.

anthonyryan1 commented 8 months ago

I would certainly ensure it continues to get used if you're willing to support it with a warning.