Hello i have a little problem, i developped a script sftp client with node js that connect to an sftp server and grab some files, i tested it with my local server its working, but when i tried to use it with production server i received this error :
Error: Handshake failed: no matching key exchange algorithm
i already generated the rsa key using ssh-keygen
here is the relevant part of the script :
var Client = require('ssh2').Client; var fs = require('fs'); var path = require('path'); var args = process.argv.slice(2); var connSettings = { host: args[0] || '127.0.0.1', port: args[1] || 22, username: args[2] || 'karim', password: args[3] || 'karimos', algorithms: { hmac: ['hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1', 'hmac-sha1-96'] } };
Advertisement
Answer
I also had the same problem and solved it by adding the following:
algorithms: { kex: [ "diffie-hellman-group1-sha1", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group-exchange-sha256", "diffie-hellman-group14-sha1" ], cipher: [ "3des-cbc", "aes128-ctr", "aes192-ctr", "aes256-ctr", "aes128-gcm", "aes128-gcm@openssh.com", "aes256-gcm", "aes256-gcm@openssh.com" ], serverHostKey: [ "ssh-rsa", "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521" ], hmac: [ "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1" ] }