admin管理员组

文章数量:1391977

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:

  • user@host:/path/to/repo - remote repo, absolute path
  • ssh://user@host:port/path/to/repo - same, alternative syntax, port can be given

When I try the first syntax, notice, without ssh://, it fails:

# b init --encryption=keyfile [email protected]:23/home/testing                     
[email protected]'s password: 
Remote: exec request failed on channel 0
Connection closed by remote host. Is b working on the server?

However, the alternative syntax works fine:

# b init --encryption=keyfile ssh://[email protected]:23/home/testing-on-12-march-2025

Why is this? The two are equivalent.Do I misunderstand?

Edit: This worked:

# BORG_RSH="ssh -p23" b init --encryption=keyfile [email protected]:/home/testing-on-14-march-2025

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:

  • user@host:/path/to/repo - remote repo, absolute path
  • ssh://user@host:port/path/to/repo - same, alternative syntax, port can be given

When I try the first syntax, notice, without ssh://, it fails:

# b init --encryption=keyfile [email protected]:23/home/testing                     
[email protected]'s password: 
Remote: exec request failed on channel 0
Connection closed by remote host. Is b working on the server?

However, the alternative syntax works fine:

# b init --encryption=keyfile ssh://[email protected]:23/home/testing-on-12-march-2025

Why is this? The two are equivalent.Do I misunderstand?

Edit: This worked:

# BORG_RSH="ssh -p23" b init --encryption=keyfile [email protected]:/home/testing-on-14-march-2025

Share Improve this question edited Mar 14 at 11:06 user2338823 asked Mar 12 at 15:14 user2338823user2338823 5551 gold badge4 silver badges21 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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 B 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 B 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 B has that. Instead, you'll need to use the ssh:// format every time if you want to use any port other than 22 for B. (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.)

本文标签: Borg backup over sshcorrect syntaxStack Overflow