garethgeorge / backrest

Backrest is a web UI and orchestrator for restic backup.
GNU General Public License v3.0
1.71k stars 49 forks source link

SFTP repo always rejects Host verification key #535

Closed bramvdzee closed 2 weeks ago

bramvdzee commented 3 weeks ago

Note: if you have a question or need support please post in the discussions area.

Describe the bug I can't add any SFTP endpoint as a repository uri, because the container cannot verify the host ssh key.

Screenshots

image

Platform Info

bramvdzee commented 3 weeks ago

For the record, I've also tried to do this with the sftp.args, without double slashes in the sftp uri, but that gave the same result.

garethgeorge commented 3 weeks ago

Another possibility is this can very often also be an issue loading the key. Try including an argument specifying the key file explicitly in the ssh command.

mpn01 commented 3 weeks ago

Had similar problem. Generate an SSH key (If you haven't earlier), and in .ssh/config file put:

Host storage-1
        HostName 192.168.1.104
        User demo
        Port 2223
        IdentityFile /path/to/your/ssh_key

Then in Repository URI put:

sftp:storage-1:/your/path
bramvdzee commented 3 weeks ago

Had similar problem. Generate an SSH key (If you haven't earlier), and in .ssh/config file put:

Host storage-1
        HostName 192.168.1.104
        User demo
        Port 2223
        IdentityFile /path/to/your/ssh_key

Then in Repository URI put:

sftp:storage-1:/your/path

I still get the same issue when using this. I've added the config to /root/.ssh/config and placed the generated SSH key in /root/.ssh/keys. My config file looks like this: Host storage-1 HostName 192.168.1.104 User demo Port 2223 IdentityFile /root/.ssh/keys/id_rsa

I've also tried the pub file: Host storage-1 HostName 192.168.1.104 User demo Port 2223 IdentityFile /root/.ssh/keys/id_rsa.pub

This still gives the Host Key Verification Failed error.

mpn01 commented 3 weeks ago

Are you using docker container to host it?

bramvdzee commented 3 weeks ago

Yes I am. I got it working with a combination of your previous post and this one: https://github.com/garethgeorge/backrest/discussions/341

I can now make backups through SFTP. Thanks!

mpn01 commented 3 weeks ago

Glad I could help a little :)