Delegated Administration
zfs allow lets non-privileged users run ZFS operations on specific
datasets — take their own snapshots, set their own properties, receive their
own replication streams — without handing out root.
Delegation is controlled by the pool property delegation, which is on
by default:
zpool get delegation pool
Granting and revoking
zfs allow alice snapshot,destroy,mount pool/home/alice
zfs allow -g devs create,mount,snapshot pool/scratch
zfs allow pool/home/alice # show what is delegated
zfs unallow alice snapshot pool/home/alice
Who:
a bare name is interpreted as
everyone, then a user, then a group — use-uor-gto be explicit;-e(or the literaleveryone) grants to all users.
Where:
-l— this dataset only (“locally”);-d— descendants only;neither or both — the dataset and all its descendants (the default).
zfs unallow takes the same selectors, plus -r to remove the delegation
recursively.
What can be delegated
Permission names are just ZFS subcommand and property names: snapshot,
clone, send, receive, rollback, destroy, hold,
load-key, compression, quota, recordsize, and so on. zfs
allow with no arguments on a dataset prints the current grants.
Several permissions imply others, and this is the usual source of confusion:
createalso needsmount(andrefreservationfor non-sparse volumes);destroy,rollbackandsnapshotalso needmount;cloneneedscreateplusmountin the origin file system;renameneedsmountandcreatein the new parent;receiveneedsmountandcreate, and is what allowszfs receive -F— usereceive:appendfor a receive permission that cannot force a rollback;allowlets a user delegate onward, but only permissions they hold themselves.
Narrower send variants exist for encrypted data: send:raw permits only raw
streams, and send:encrypted permits raw streams of encrypted datasets only
— both prevent an encrypted dataset from being sent in decrypted form. See
Native Encryption.
Note
On Linux the mount, unmount, mountpoint, canmount,
rename and share permissions cannot be delegated, because
mount(8) restricts changes to the global namespace to root. Since
create, destroy, snapshot and friends require mount, a
fully self-service setup on Linux still needs help from root or from a
setuid helper.
Permission sets
A named set groups permissions so they can be granted as a unit and changed
later in one place. Set names begin with @.
zfs allow -s @backup send,snapshot,hold,destroy pool/data
zfs allow backupuser @backup pool/data
zfs unallow -s @backup pool/data
Create-time permissions
zfs allow -c sets create-time permissions: they are granted locally to
whoever creates a new descendant file system. This is how a user who is
allowed to create datasets automatically becomes able to administer the ones
they created.
zfs allow -c snapshot,destroy,mount pool/scratch
Further reading
zfs-allow(8) — the full permission table
zpoolprops(7) —
delegation