Question regarding path definition when using sftp

Hi,

my scenario is as fallows:

i have defined a host in my .ssh/config
the config looks like this:

Host abc
 Hostname somehost
 User someuser
 port 4711
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/ed25519_key

When I use this file to connect and authenticate I have to remove the “/” at the start of the path statement so that the command starts like this

restic -r sftp:abc:directory

but when I define the user and host manually the path statement needs to start with the “/” so that the command looks like this:

restic -r sftp://user@server:/directory

I should also note that the restic repo is located in the root directory of my storage server

Can somebody help me to understand why I have to define that path statement in two different ways.
Thanks!

Using the URL syntax, the separator between server and directory is the /. The colon is used to separate server name and port. For example sftp://host:10022//dir/subdir would connect to host:10022 and access /dir/subdir (notice the double slash!)

1 Like