kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
527 stars 239 forks source link

Some user-permission changes to btrfs-progs #762

Open sweettea opened 3 months ago

sweettea commented 3 months ago

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).

adam900710 commented 3 months ago

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 commented 3 months ago

Snapshotting shouldn't require root?

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

kdave commented 2 months ago

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 commented 3 weeks ago

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.