digint / digint/btrbk

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

Open
#592 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
2.1k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the backend_local_user and ssh_user handling described in btrbk.conf, then reproduce the issue with `btrbk run -v -progress --dry-run`. Compare the remote command for btrfs subvolume listing with the documented `btrfs-progs-sudo` behavior; done means the remote command includes `sudo -n` and works for a non-root SSH user.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.