How can I reuse an ssh connection on windows? Ive been using these settings in my _vimrc for sftp and noticed that each time I browse or try to edit a file with netrw, a new connection is created which takes an awful long time.

let g:netrw_cygwin = 0
let g:netrw_ssh_cmd  = '"C:\Program Files\PuTTY\plink.exe" -batch -T -ssh'
let g:netrw_scp_cmd  = '"C:\Program Files\PuTTY\pscp.exe"  -batch -q -scp'
let g:netrw_sftp_cmd = '"C:\Program Files\PuTTY\pscp.exe"  -batch -q -sftp'
let g:netrw_list_cmd = '"C:\Program Files\PuTTY\plink.exe" myuser@mysite.com ls -Fa '

I have also tried to use cyg-wrapper.sh to avoid this problem

:e scp://myuser@mysite.com:22//home

but a cmd window opens up with this error

/bin/bash -c "/usr/bin/scp -q -P 22 "myuser@mysite
.com:/home" "C:\cygwin\tmp\VIA3996.tmp""
The system cannot find the path specified.
shell returned 1
Hit any key to close this window...

I tried scp because I didnt know how to use a private key for sftp at the time within cygwin


According to keeping ssh connections open on windows, PuTTY doesn't support connection sharing. So, try using one of the mentioned OpenSSH ports instead with the configuration mentioned in the question.

  • apparently, cygwin does not support connection sharing cygwin.com/ml/cygwin/2012-02/msg00366.html which OpenSSh_for_windows also uses – Aldon Palmer Oct 5 '13 at 18:29
  • apparently Putty does in version 0.66 and possibly before, since I came here looking for info on the PuTTY message "Reusing a shared connection to this server" – simpleuser Mar 29 '16 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.