fuse icon indicating copy to clipboard operation
fuse copied to clipboard

Mount: use device directly if we are root.

Open rminnich opened this issue 8 years ago • 6 comments

The mount function in mount_linux.go checks if we are uid 0 and, if so, tries to just do the mount directly. If that fails, then it will fall through to the fusermount path.

I've tested this on a server of my own and it works.

Signed-off-by: Ronald G. Minnich [email protected]

rminnich avatar Feb 27 '18 02:02 rminnich

What is the benefit of this PR? Is there any performance gain?

chrislusf avatar Dec 30 '18 21:12 chrislusf

@chrislusf it allows to remove the runtime dependency on fusermount and the c-fuse package IFF the user is guaranteed to be root

zimbatm avatar Feb 22 '19 13:02 zimbatm

@zimbatm thanks for confirming!

chrislusf avatar Feb 22 '19 17:02 chrislusf

I like this patch. In my case I (initially) wanted to run this in a chroot, but couldn't because of the other binary missing. That's also a use case that is fixed by this patch.

Having said that, I think there's even more room for improvement. At least in theory, it's possible for someone to not have uid 0, but still be allowed to mount devices (e.g. through CAP_SYS_ADMIN). You could also just attempt to mount it directly, and if that doesn't work, fallback on the external binary?

Freeaqingme avatar May 15 '19 20:05 Freeaqingme

I'd like to support this patch. It is definitly a gain of usabililty if we're independend on an external binary (even if for the uid=0 case only). The suggestions to first try it directly and then fallback to fusemount seem sensible.

I'd like to see this patch in the mainline :)

HeikoSchlittermann avatar May 08 '20 14:05 HeikoSchlittermann

I like the general idea, but you really shouldn't be running as root (or CAP_SYS_ADMIN either). I'd like to see a complete story about that; go is not great at doing setuid (EDIT: I mean dropping privs, not chmod u+s), so I feel like doing this "right" will involve a bit more than just calling these APIs.

tv42 avatar May 08 '20 17:05 tv42