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

Some user-permission changes to btrfs-progs #762

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

sweettea
Copy link
Contributor

This makes it possible to use btrfs receive as a regular user, and gets part of the way to using btrfs subvolume list as a regular user (the main change there is pretty big so it's going in a different pull request).

For non-root usage, receive can't write compressed data and will get
EPERM, but falling back to writing uncompressed data may work and allows
receive as a normal user, which is safer.

Signed-off-by: Sweet Tea Dorminy <[email protected]>
The user ioctl works in all cases, so don't limit subvolume list to root
by using the root-only ioctl. Subvolume list itself still uses the
root-only tree search ioctl, but this is a step toward making subvolume
list user-capable.

Signed-off-by: Sweet Tea Dorminy <[email protected]>
@adam900710
Copy link
Collaborator

For data writes it's totally fine to fallback to non-privileged writes.

But wouldn't things like snapshotting and UUID tree updates still requires root privilege?

@sweettea
Copy link
Contributor Author

Snapshotting shouldn't require root?

But uuid search, good point, I was running on a kernel with uuid search allowed for non-root.

@kdave
Copy link
Owner

kdave commented Apr 18, 2024

There are the unprivileged subvolume ioctls, I'm not sure if there are also helpers for that but this should be possible to implement by manual iteration.

@kdave
Copy link
Owner

kdave commented Jun 12, 2024

I'm taking another look, the idea of using unprivileged ioctls makes sense but we can go further and use the library functions (receive code is old so the interface was not there). I'd apply the patches but the change in lookup_ino_path() to strcpy(ri->name, args.name); looks like it's ignoring the following code that checks args.name[0] and build the path.

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

Successfully merging this pull request may close these issues.

3 participants