6

I want to delegate non-root user to delete read-only subvolumes (snapshots).

What exactly capabilities/rights I need to grant, so that he can remove his own read-only snapshots?

I've already mounted the btrfs with -o user_subvol_rm_allowed so users can remove read/write snapshots.

I need it to augment otherwise brillant SnapBtr.py, so non-root users can operate it.

1 Answer 1

9

A user can not delete readonly snapshots directly, but he can make them writeable first and then delete them. For this you need to use the btrfs property command:

btrfs property set -ts /path/to/snapshot ro false

If the user is the owner of the snapshot, this should make it writeable and therefore deletable.

3
  • That is cool. Thank you! Too bad, that the btrfs-tools v3.12 present on Ubuntu 14.04 does not include this command - but that is a different story. Aug 13, 2014 at 22:11
  • 2
    I also stumbled across this. TBH I think that's a plain btrfs bug. Feb 2, 2016 at 11:10
  • 1
    Hint: If you run btrfs property set -ts /path/to/subvolume ro false and rm -rf still complains about Read-only file system, then make sure all nested subvolumes are also not read-only.
    – ominug
    Jan 6, 2023 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .