autorestic
autorestic copied to clipboard
SFTP url parsing broken
Describe the bug I have identified a scenario where the URL for sftp backends do not get parsed properly:
SFTP backend with non-standard port
postapocalyptic-backup:
type: sftp
path: 192.168.1.100:2123:/folder
key: "wow"
This gives me a:
subprocess ssh: ssh: connect to host 192.168.1.100 port 22: Connection refused
Fatal: unable to open repo at sftp:192.168.1.100:2022:/folder: unable to start the sftp session, error: EOF
(Wrong port attempted)
Probably due to the fact that we need to format it as a proper SFTP url before passing it to Restic, see: https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#sftp
If you need to specify a port number or IPv6 address, you’ll need to use URL syntax. E.g., the repository /srv/restic-repo on [::1] (localhost) at port 2222 with username user can be specified as sftp://user@[::1]:2222//srv/restic-repo
I can work around this by formatting my .autorestic.yml
as follows:
postapocalyptic-backup:
type: sftp
path: //192.168.1.100:2123/folder # notice the missing colon before the '/folder'
key: "wow"
It does work, but it might be a bit confusing, and not entirely intended.
Environment
- OS: Ubuntu 22.04
- Version: 1.7.1
Regardless, thanks for your work (and all contributors)!
Don't know how to fix that 192.168.1.100:2022:/folder
is not standard and should not be accepted. Maybe we should add a field host and a field port when the backend is sftp
I am wondering if we should give up the type
field to only have a path
field including the type as restic use them in the same option.
Agreed that it's not standard, but it results in what the Restic documentation calls a 'sftp url'. Which is the only way to specify an alternate ssh port (besides using ~/.ssh/config
)
-------- Original Message -------- On Aug 28, 2022, 17:10, Romain de Laage wrote:
Don't know how to fix that 192.168.1.100:2022:/folder is not standard and should not be accepted. Maybe we should add a field host and a field port when the backend is sftp I am wondering if we should give up the type field to only have a path field including the type as restic use them in the same option.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>