Syncoid between machines without root
Syncoid is a handy utility to backup ZFS pools. Although you can sync between datasets on the same machine, the real utility is when you sync across machines via ssh. This makes offsite backups a breeze.
Anyhow, it’s easy if you have root access on your SOURCE and TARGET machines. But this means you’re SSHing as root, which means you must allow root SSH access, and that gives me the heeby-jeebies.
So I progressively gave my regular user the zfs
permissions until syncoid worked. If you’d like to use syncoid without root, this is probably a good set of snippets to get started.
On the SOURCE machine (Ubuntu 22.04):
sudo zfs allow -u [USER] send,hold,snapshot,destroy [SOURCEPOOL]
On the TARGET machine (FreeBSD 13.2):
sudo zfs allow -u [USER] compression,mountpoint,create,mount,receive,rollback,destroy [TARGETPOOL]
Once you’ve sorted out the privleges above, the below command should work from the target machine:
syncoid -R --no-privilege-elevation [SOURCE]:[SOURCEPOOL] [TARGETPOOL]/[SOURCEPOOL]