digint / btrbk

Tool for creating snapshots and remote backups of btrfs subvolumes
https://digint.ch/btrbk/
GNU General Public License v3.0
1.71k stars 123 forks source link

btrbk doesn't append a command with "sudo -n" if ssh is used and backend_local_user=btrfs-progs-sudo #592

Open JorisBlom opened 4 months ago

JorisBlom commented 4 months ago

I added the commands btrfs, readlink, and test to the sudoers file on both systems to make btrbk without sudo possible. My btrbk.conf file is:

backend_local_user         btrfs-progs-sudo
ssh_user                   anna

volume ssh://154.186.17.112:22/
snapshot_dir home/user/.snapshots
target       /mnt/backup
subvolume    home/user

When I run btrbk run -v -progress --dry-run I get the following warnings:

WARNING: Skipping subvolume "154.186.17.112[22]:/home/user": Failed to fetch subvolume detail
WARNING: ... Command execution failed (exitcode=1)
WARNING: ... sh: ssh -p 22 anna@154.186.17.112 'btrfs subvolume list -a -c -u -q -R '\''/home/user'\'''
WARNING: ... can't perform the search: Operation not permitted

The warning states that ssh -p 22 anna@154.186.17.112 'btrfs subvolume list -a -c -u -q -R '\''/home/user'\''' is the command the program is trying to execute. The btrfs command is not appended with sudo -n like the documentation states (backend_local_user=btrfs-progs-sudo). ssh -p 22 anna@154.186.17.112 'sudo -n btrfs subvolume list -a -c -u -q -R '\''/home/user'\''' would run just fine (with sudo -n added). This seems like a bug to me.

If I change ssh_user to root, the program will run fine too, but my goal is to disable root logins for ssh. Is there any way to achieve this?