Init on windows with sftp and plink hangs

When i run on windows 7 the following command:
restic -o sftp.command=“sftp.bat” --repo -p pw.txt init

where sftp.bat contains lines:
@echo off
plink -v -s -l user -P 123 -i example.ppk sftp

then command hangs with last output lines:
subprocess sftp.bat: Access granted
subprocess sftp.bat: Opening session as main channel
subprocess sftp.bat: Opened main channel
subprocess sftp.bat: Started a shell/command

This hanged command creates on my server home folder the folder backup, the folder backup/keys is empty.

restic version:
restic 0.8.3
compiled with go1.10 on windows/amd64

sftp server runs on Ubuntu:
4.4.0-124-generic #148-Ubuntu SMP Wed May 2 13:00:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

It seems that Penquincoder had the same problem with no solution:

Any suggestions how to get restic with plink to work on windows?

Actually i was too impatient: repo init did not hang, but it did took really long time, 4 minutes. In this time restic patiently created subdirectories in repo data folder, one by one. This long time is a bit surprising, considering that local rebo init takes only couple of seconds and the network connection is not that bad.

If i ignore the long time which it took to init the repo, then restic on windows with sftp backend and plink is working actually quite nicely and has already without a glitch archived the first 0.5 TB of data. I’m a happy camper.

Thanks for leaving feedback on your own posting! Creating a new repo on Linux via sftp also hangs for some time, I have this on my todo list for improvement some time later…

It’d be interesting to know: what’s the latency to the sftp server? The reason it takes some time is that for creating a directory, a request is sent to the server, restic then waits for the acknowledgment, and then creates the next folder. If the round-trip latency is 80ms, the lower bound for the creation of the 256 subdirs in data/ will take at least 256*0.08s = 20.48s

AFAIK plink uses only 1 connection. Wondering if pairing restic with rclone would speed things up.

Doesn’t matter, sftp does multiplexing on the protocol level. I’d still be interested in reports how well rclone with restic on windows perform.

I’ll try to do some performance comparisons as soon as I find some spare time.