Sftp path issue relative to root

When i run this command…

restic -r “sftp://root@domain.org:/mnt/nfs-backup/restic-backup” init

what it actually does is start saving to /root/mnt/nfs-backup/restic-backup. The heck? why would an absolute path be relative to the user’s home directory?

what’s going on here?

i can’t figure out how to get around this. but this is not behaving at all how scp would…or, honestly any remote protocol i’ve used before

I don’t know about other protocols, but the docs seem to be quite clear with sftp:


You have two syntax options. The standard uses no double-slash between the protocol and the address, while with URL syntax you do have a double slash, and then between the connection and the path:

Note the double slash: the first slash separates the connection settings from the path, while the second is the start of the path. To specify a relative path, use one slash.

So either use the standard syntax:
restic -r “sftp:root@domain.org:/mnt/nfs-backup/restic-backup” init

Or the URL syntax which you’re using:
restic -r “sftp://root@domain.org://mnt/nfs-backup/restic-backup” init

Note that I can’t verify the above - I don’t have an sftp repo. Just going off the docs.

perfect, thank you that fixed it. the out of the ordinary uri syntax threw me for a loop. the double slash is particularly weird for a non protocol specifier path like that