docker-borgmatic icon indicating copy to clipboard operation
docker-borgmatic copied to clipboard

BORG_RSH does not work

Open dave12311 opened this issue 1 year ago • 4 comments

Command specified by BORG_RSH does not seem to get passed to ssh.

E.g. trying to specify a key with a non-default name BORG_RSH="ssh -i /root/.ssh/borgbase" results in

SSH command line: ['ssh', '<REDACTED>.repo.borgbase.com', 'borg', 'serve', '--debug']
Remote: <REDACTED>.repo.borgbase.com: Permission denied (publickey).
Connection closed by remote host. Is borg working on the server?
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/borg/archiver.py", line 5324, in main
    exit_code = archiver.run(args)
                ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/borg/archiver.py", line 5255, in run
    return set_ec(func(args))
                  ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/borg/archiver.py", line 161, in wrapper
    repository = RemoteRepository(location.omit_archive(), create=create, exclusive=argument(args, exclusive),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/borg/remote.py", line 578, in __init__
    raise ConnectionClosedWithHint('Is borg working on the server?') from None
borg.remote.ConnectionClosedWithHint: Connection closed by remote host. Is borg working on the server?

Platform: Linux 198e743aacb9 5.10.160-rk35xx #1 SMP Thu Jul 6 13:36:29 UTC 2023 aarch64
Linux: Unknown Linux  
Borg: 1.2.6  Python: CPython 3.11.5 msgpack: 1.0.5 fuse: llfuse 1.5.0 [pyfuse3,llfuse]
PID: 15  CWD: /
sys.argv: ['/usr/local/bin/borg', 'init', '--encryption', 'repokey-blake2', '--debug', 'ssh://<REDACTED>.repo.borgbase.com/./repo']
SSH_ORIGINAL_COMMAND: None

Renaming the key to the default id_rsa works.

dave12311 avatar Sep 03 '23 12:09 dave12311

You may already be aware, but you can set the ssh_command option in borgmatic's configuration instead of the BORG_SSH environment variable.

witten avatar Sep 03 '23 15:09 witten

@dave12311 - did @witten's comment assist? Are you still having this issue?

modem7 avatar Apr 01 '24 19:04 modem7

I ended up just passing the key with the default name using VOLUME_SSH, but I guess the documentation should still be updated to reflect this. Thanks for the help though!

dave12311 avatar Apr 01 '24 20:04 dave12311

I ended up just passing the key with the default name using VOLUME_SSH, but I guess the documentation should still be updated to reflect this. Thanks for the help though!

Happy to review a PR for this!

modem7 avatar Apr 01 '24 20:04 modem7