vscode-sftp icon indicating copy to clipboard operation
vscode-sftp copied to clipboard

Timed out while waiting for handshake

Open JeffrySteegmans opened this issue 5 years ago • 18 comments

When I try to connect with my synology nas (sftp) with config:

{ "name": "home-assistant", "protocol": "sftp", "host": "xxx.synology.me", "port": 22, "username": "xxxx", "password": "xxxx", "remotePath": "/docker/home-assistant", "connectTimeout": 3600, "secure" : true, "ignore": [ ".vscode", ".git" ] }

I get the following error:

[08-01 13:21:17] [trace] run command 'Upload File' [08-01 13:21:17] [trace] handle upload file for c:\Workspace\YAML\HASS.vscode\sftp.json [08-01 13:21:17] [debug] Local ident: 'SSH-2.0-ssh2js0.4.2' [08-01 13:21:17] [debug] Client: Trying xxxx.synology.me on port 22 ... [08-01 13:21:17] [debug] Client: Connected [08-01 13:21:17] [debug] Remote ident: 'SSH-2.0-OpenSSH_7.4' [08-01 13:21:17] [debug] Outgoing: Writing KEXINIT [08-01 13:21:17] [debug] DEBUG: Comparing KEXINITs ... [08-01 13:21:17] [debug] (local) KEX algorithms: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1 [08-01 13:21:17] [debug] (remote) KEX algorithms: [email protected],diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521 [08-01 13:21:17] [debug] KEX algorithm: ecdh-sha2-nistp256 [08-01 13:21:17] [debug] (local) Host key formats: ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 [08-01 13:21:17] [debug] (remote) Host key formats: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [08-01 13:21:17] [debug] Host key format: ssh-rsa [08-01 13:21:17] [debug] (local) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected] [08-01 13:21:17] [debug] (remote) Client->Server ciphers: aes128-ctr,[email protected],aes192-ctr,aes256-ctr,[email protected],[email protected] [08-01 13:21:17] [debug] Client->Server Cipher: aes128-ctr [08-01 13:21:17] [debug] (local) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected] [08-01 13:21:17] [debug] (remote) Server->Client ciphers: aes128-ctr,[email protected],aes192-ctr,aes256-ctr,[email protected],[email protected] [08-01 13:21:17] [debug] Server->Client Cipher: aes128-ctr [08-01 13:21:17] [debug] (local) Client->Server HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1 [08-01 13:21:17] [debug] (remote) Client->Server HMAC algorithms: hmac-sha1,[email protected],hmac-sha2-256,[email protected],hmac-sha2-512,[email protected],[email protected],[email protected],[email protected],[email protected] [08-01 13:21:17] [debug] Client->Server HMAC algorithm: hmac-sha2-256 [08-01 13:21:17] [debug] (local) Server->Client HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1 [08-01 13:21:17] [debug] (remote) Server->Client HMAC algorithms: hmac-sha1,[email protected],hmac-sha2-256,[email protected],hmac-sha2-512,[email protected],[email protected],[email protected],[email protected],[email protected] [08-01 13:21:17] [debug] Server->Client HMAC algorithm: hmac-sha2-256 [08-01 13:21:17] [debug] (local) Client->Server compression algorithms: none,[email protected],zlib [08-01 13:21:17] [debug] (remote) Client->Server compression algorithms: none,[email protected] [08-01 13:21:17] [debug] Client->Server compression algorithm: none [08-01 13:21:17] [debug] (local) Server->Client compression algorithms: none,[email protected],zlib [08-01 13:21:17] [debug] (remote) Server->Client compression algorithms: none,[email protected] [08-01 13:21:17] [debug] Server->Client compression algorithm: none [08-01 13:21:17] [debug] Outgoing: Writing KEXECDH_INIT [08-01 13:21:17] [debug] DEBUG: Checking host key format [08-01 13:21:17] [debug] DEBUG: Checking signature format [08-01 13:21:17] [debug] DEBUG: Verifying host fingerprint [08-01 13:21:17] [debug] DEBUG: Host accepted by default (no verification) [08-01 13:21:17] [debug] DEBUG: Verifying signature [08-01 13:21:17] [debug] Outgoing: Writing NEWKEYS [08-01 13:21:17] [debug] Outgoing: Writing SERVICE_REQUEST (ssh-userauth) [08-01 13:21:17] [debug] Outgoing: Writing USERAUTH_REQUEST (none) [08-01 13:21:17] [debug] Client: none auth failed [08-01 13:21:17] [debug] Outgoing: Writing USERAUTH_REQUEST (password) [08-01 13:21:20] [debug] Outgoing: Writing DISCONNECT (BY_APPLICATION) [08-01 13:21:20] [error] Error: [steegmans.synology.me]: Timed out while waiting for handshake at Client.module.exports._connectSSHClient.e.on.on.e (C:\Users\jeffry.steegmans.vscode\extensions\liximomo.sftp-1.12.7\dist\extension.js:70:107136) at Client.emit (events.js:187:15) at Timeout._onTimeout (C:\Users\jeffry.steegmans.vscode\extensions\liximomo.sftp-1.12.7\node_modules\ssh2\lib\client.js:692:14) at ontimeout (timers.js:425:11) at tryOnTimeout (timers.js:289:5) at listOnTimeout (timers.js:252:5) at Timer.processTimers (timers.js:212:10)

Is this a known issue?

JeffrySteegmans avatar Aug 01 '19 11:08 JeffrySteegmans

Check connection of your server. Try a larger connectTimeout value.

liximomo avatar Aug 01 '19 14:08 liximomo

I am getting the same thing. Most times with other programs there is a known host file or at the least an interactive button you can hit to add the host to the list of known host. I feel like the issue is that is is trying to determine the status of the host but the plugin is not asking for you to confirm the host.

webternals avatar Sep 11 '19 19:09 webternals

I have the same problem. Sometimes connected, but most often not

BlackGrizzly avatar Oct 17 '19 13:10 BlackGrizzly

I have this problem too

IProudNoob avatar Oct 27 '19 08:10 IProudNoob

I am having the same issue

disapamok avatar Nov 09 '19 05:11 disapamok

I have the same issue on 'sftp' protocol. There is no problem whatsoever when connecting through regular 'ftp'.

SOLVED

"remotePath" should be different on regular ftp and sftp, e.g.: ftp: /www/folder, sftp: /home/username/www/folder.

Changing path to full on sftp solved the problem for me.

See #356

dziku86 avatar Nov 27 '19 15:11 dziku86

Have the same problem. I use absolute path, not a symlink. Can't connect to my syno. Is any real treatment?

Spirituss avatar Sep 26 '20 12:09 Spirituss

Hi @liximomo

Do we have any workaround for this issue? Also, changelog, versions not in sync.

filopd avatar Oct 08 '20 07:10 filopd

@filopd The workaround is to set "connectTimeout": 40000 into sftp.json.

Spirituss avatar Oct 08 '20 10:10 Spirituss

In my case, my ISP (Netlife, EC) sometimes blocks connections to port 22, sometimes not. In fact, I was connected a few minutes ago, then suddenly, I wasn't able to connect. Then I tried to connect from the terminal through SSH and I couldn't. So, test If you can connect with ssh, if it is not possible, then probably it is not this plugin's fault.

Fortunately I already had a VPN service because I have had these kind of issues before. I'm using VPN Express, but any VPN will work for you. I'm not endorsing this particular VPN, just saying it worked for me.

I don't think changing the timeout from 20000 to 40000 will do the trick, 20000 is enough waiting for most cases.

beto-aveiga avatar Nov 25 '20 22:11 beto-aveiga

i've tried most of the solutions above, the timeout error is still there. i dont think i have a connection problem coz i can ssh into the server . so any workaround this problem is greatly appreciated .

conrad96 avatar Feb 17 '21 08:02 conrad96

i cant connect and the log return Timed out while waiting for handshake

mredodos avatar Jan 28 '22 13:01 mredodos

In my case, my ISP (Netlife, EC) sometimes blocks connections to port 22, sometimes not. In fact, I was connected a few minutes ago, then suddenly, I wasn't able to connect. Then I tried to connect from the terminal through SSH and I couldn't. So, test If you can connect with ssh, if it is not possible, then probably it is not this plugin's fault.

Fortunately I already had a VPN service because I have had these kind of issues before. I'm using VPN Express, but any VPN will work for you. I'm not endorsing this particular VPN, just saying it worked for me.

I don't think changing the timeout from 20000 to 40000 will do the trick, 20000 is enough waiting for most cases.

I'm the opposite, after turning on vpn it times out.

image image

What do I need to pay attention to in terms of vpn settings?

faydanube avatar Jun 04 '22 02:06 faydanube

TORAH TECH: ### port number conflict In my case: Close down the torrent download application, which uses port #s. If SFTP works one moment and the next times out of the handshake and won't connect to remote server then: Check any programs that are simultaneously running that you know uses PORT # for services. Hope this helps, Shalom! Ben Yahceph July (hot as Hell) 2022` around 12:30 PM port number conflict

TORAHTECH avatar Jul 22 '22 16:07 TORAHTECH

my problem is similar to yours. In my case, on FileZilla it is working just when Encryption is set to: "Use explicit FTP over TLS is available".

I can't find, or I don't know the way to make it works.

Any idea?

arilishu avatar Sep 06 '22 17:09 arilishu

my problem is similar to yours. In my case, on FileZilla it is working just when Encryption is set to: "Use explicit FTP over TLS is available".

I can't find, or I don't know the way to make it works.

Any idea?

I have not been able to solve the problem, and continue to pay attention to. I'm having to switch vpn on and off very frequently to get it to barely work.

faydanube avatar Sep 09 '22 04:09 faydanube

I've run into an issue where I have 2 hosts (nearly identical VMs) and this plugin works with one but not the other. I've compared the output of just connecting using ssh with debug3 and everything is the same. No idea why one host gets a handshake timeout while the other is just fine.

rayr007 avatar Sep 22 '22 00:09 rayr007

Actually, I found my issue. I use a ProxyCommand in the ssh config file to do a hop through a host. The server that worked with this plugin had it's config wrong and was not requiring the hop while the server that isn't working is properly configured to require the hop. So in the end, the bug I've run into is that this plugin does NOT respect configuration in the ~/.ssh/config file even if I specify it.

For reference, my config file:

Host *.domain.com
    User hostUserName
    ProxyCommand ssh proxyUserName@proxyHost nc %h %p

rayr007 avatar Sep 22 '22 00:09 rayr007