Note: My setup is a server hosted by Hetzner and a storage box hosted by Hetzner.
This link says:
Remote repositories accessed via ssh user@host:
When I try the first syntax, notice, without ssh://
, it fails:
# borg init --encryption=keyfile uxxxxxx@uxxxxxx.your-storagebox.de:23/home/testing
uxxxxxx@uxxxxxx.your-storagebox.de's password:
Remote: exec request failed on channel 0
Connection closed by remote host. Is borg working on the server?
However, the alternative syntax works fine:
# borg init --encryption=keyfile ssh://uxxxxxx@uxxxxxx.your-storagebox.de:23/home/testing-on-12-march-2025
Why is this? The two are equivalent.Do I misunderstand?
Edit: This worked:
# BORG_RSH="ssh -p23" borg init --encryption=keyfile uxxxxxx@uxxxxxx.your-storagebox.de:/home/testing-on-14-march-2025
They aren't quite as equivalent as they first appear.
In the version with ssh://
, the colon (:
) in host:23
separates the hostname from the port; the SSH client in Borg uses the specified port (23). In the version without ssh://
, the colon separates the hostname from the first part of the file path; the SSH client in Borg uses the standard SSH port (22). From the error you posted, your host isn't listening on port 22, so the connection is never established.
Most SSH clients have a -p
or --port
CLI flag where you could define a specific nonstandard port, but it doesn't look like Borg has that. Instead, you'll need to use the ssh://
format every time if you want to use any port other than 22 for Borg. (This is a common question on the git
tag, btw; all the major repo hosts offer an alternate hostname listening on port 443 for SSH traffic in case a network or ISP filters port 22.)