Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] The way AllowOther is handled is confusing #321

Open
0x53A opened this issue Nov 25, 2024 · 0 comments
Open

[minor] The way AllowOther is handled is confusing #321

0x53A opened this issue Nov 25, 2024 · 0 comments

Comments

@0x53A
Copy link

0x53A commented Nov 25, 2024

As a preface, I don't know much about how fuse works.

I created a new rust project, referenced this crate and copied the simple example into main.rs. So far so good.

On startup, it fails with

fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf

Of course, the simple option would be to do that, but instead I'm looking for why 'allow_other ' is set at all, because it's not done by me.

Running it with verbose logging shows:

[2024-11-25T23:20:03.185848941Z WARN fuser::session] Given auto_unmount without allow_root or allow_other; adding allow_other, with userspace permission handling

And in session I find:

        // If AutoUnmount is requested, but not AllowRoot or AllowOther we enforce the ACL
        // ourself and implicitly set AllowOther because fusermount needs allow_root or allow_other
        // to handle the auto_unmount option
        let (file, mount) = if options.contains(&MountOption::AutoUnmount)
            && !(options.contains(&MountOption::AllowRoot)
                || options.contains(&MountOption::AllowOther))
        {
            warn!("Given auto_unmount without allow_root or allow_other; adding allow_other, with userspace permission handling");
            let mut modified_options = options.to_vec();
            modified_options.push(MountOption::AllowOther);
            Mount::new(mountpoint, &modified_options)?
        } else {
            Mount::new(mountpoint, options)?
        };

Aha, I think, and add AllowRoot in main.rs.

And ... it still fails with the same error???

A little bit of digging later, I see, in mountoptions.rs:

// Format option to be passed to libfuse or kernel
pub fn option_to_string(option: &MountOption) -> String {
    match option {
        // [...]
        MountOption::AllowOther => "allow_other".to_string(),
        // AllowRoot is implemented by allowing everyone access and then restricting to
        // root + owner within fuser
        MountOption::AllowRoot => "allow_other".to_string(),
        // [...]
    }
}

So the only option (besides setting 'user_allow_other' in /etc/fuse.conf) is to remove AutoUnmount from main.rs. Which is added unconditionally, despite AllowOther being behind a check of fuse_allow_other_enabled.

Of course this is a trivial issue, just wanted to report it. please feel free to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant