# Trying to connect to SFTP storage

**URL:** https://kopia.discourse.group/t/trying-to-connect-to-sftp-storage/50
**Category:** Support
**Created:** [August 26, 2020, 7:29am UTC](https://kopia.discourse.group/t/trying-to-connect-to-sftp-storage/50 "2020-08-26T07:29:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![artfulrobot](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/artfulrobot/32/20_2.png) [@artfulrobot](https://kopia.discourse.group/u/artfulrobot)
#### Post date: [August 26, 2020, 7:29am UTC](https://kopia.discourse.group/t/trying-to-connect-to-sftp-storage/50/1 "2020-08-26T07:29:05Z")

</div>

I’m evaluating kopia and [restic](https://github.com/restic/restic). (Currently I’ve got restic working but have not had success with kopia. Restic seems good and robust but I have a slight concern about the time it takes to prune snapshots)

I have 200GB possibly rising to 1TB to backup, from multiple hosts. My current strategy is buying SFTP-accessible space (from Hetzner, what they call a “storage box”) becuase the space allocation can grow and shrink without the faff and risks of changing partitions, filesystems etc.

Initially I tried to get Kopia to connect to the SFTP storate, but failed. I think some of that might be [bugs](https://github.com/kopia/kopia/issues/500#issuecomment-679132751) and some of it may be a lack of features, or it may be a lack of documentation; I’m unsure.

I’m now wondering whether the following setup might work:

1. SFTP server (no shell access) for storage

2. Backup server mounts (1) locally by sshfs, and runs Kopia Repository Server

3. Mulitple client servers that need backing up connect to (2) to stow their data.

What I want to know is: do you think tihs will work? Is it sensible?

If so, I need to know that the clients (3) can be limited to creating backups - otherwise a compromised client server could delete its backups, which would not be nice!

Many thanks,  
Rich

---

<div class="post-metadata">

### Author: ![jkowalski](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/jkowalski/32/3_2.png) [@jkowalski](https://kopia.discourse.group/u/jkowalski)
#### Post date: [August 27, 2020, 4:30am UTC](https://kopia.discourse.group/t/trying-to-connect-to-sftp-storage/50/2 "2020-08-27T04:30:45Z")

</div>

That would absolutely work, but is sort of a workaround. would encourage anybody with access to problematic SFTP hosts (which I sadly don’t have) to actually fix the underlying issues in SFTP provider. I’ll be happy to review and merge PRs but my ability to reproduce issues with these providers is limited.

---

<div class="post-metadata">

### Author: ![artfulrobot](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/artfulrobot/32/20_2.png) [@artfulrobot](https://kopia.discourse.group/u/artfulrobot)
#### Post date: [August 27, 2020, 7:44am UTC](https://kopia.discourse.group/t/trying-to-connect-to-sftp-storage/50/3 "2020-08-27T07:44:16Z")

</div>

Thanks, that’s good news, I may give that a go then.

> [@jkowalski](#):
>
> problematic SFTP hosts

I don’t think it’s a problem with the SFTP host, I think it’s a problem with kopia’s implementation; restic’s SFTP backend works just fine, the Debian sftp command lne works fine, Gnome’s GIO SFTP wrapper works fine, for example.

Or it could be a problem with my knowledge of SSH. restic works as most ssh things work on my Debian box (e.g. rsync, scp, sftp, git…) which all understand `.ssh/config` entries, all connect to local ssh key agents, (thereby supporting encrypted ssh keys, the local known\_hosts format which uses hashed hostname/ips) etc. kopia seems to need everything provided on the command line (and unencrypted keys and unhashed known\_hosts data).

So whereas with one of the other tools I’d go like `git clone storagehost:repo.git` or `restic -r sftp:storagehost:restic-repo` etc. with kopia my command looks like:

```auto

kopia repository create sftp \
  --username=username \
  --path /home/kopia-repo \
  --host=storagehost.fqdn \
  --port=23 \
  --keyfile .ssh/id_rsa
  --known-hosts-data='storagehost.fqdn,1.2.3.4 ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=='

```

And then I still get an error

> kopia: error: can’t connect to storage: unable to dial [storagehost.fqdn:23]: &{Config:{Rand: RekeyThreshold:0 KeyExchanges: Ciphers: MACs:} User:username Auth:[0xdf47e0] HostKeyCallback:0xdf94c0 BannerCallback:  
> ClientVersion: HostKeyAlgorithms: Timeout:0s}: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain, try --help

There’s no option to specify the _public_ key, does kopia generate the public key from the private key or something?

I’d rather not use a workaround if kopia can connect using its own SFTP, so any tips/help very would be very welcome 🙂

---

<div class="post-metadata">

### Author: ![jkowalski](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/jkowalski/32/3_2.png) [@jkowalski](https://kopia.discourse.group/u/jkowalski)
#### Post date: [August 30, 2020, 11:16pm UTC](https://kopia.discourse.group/t/trying-to-connect-to-sftp-storage/50/4 "2020-08-30T23:16:29Z")

</div>

Strange. Are you sure this is port 23 (telnet) and not 22 (ssh) ?

---

<div class="post-metadata">

### Author: ![artfulrobot](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/artfulrobot/32/20_2.png) [@artfulrobot](https://kopia.discourse.group/u/artfulrobot)
#### Post date: [August 31, 2020, 6:05pm UTC](https://kopia.discourse.group/t/trying-to-connect-to-sftp-storage/50/5 "2020-08-31T18:05:00Z")

</div>

@jkowalski yep I reaslise it’s on a custom (and unusual) port.
