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 :
JavaScript
x
17
17
1
var Client = require('ssh2').Client;
2
var fs = require('fs');
3
var path = require('path');
4
5
var args = process.argv.slice(2);
6
7
var connSettings = {
8
host: args[0] || '127.0.0.1',
9
port: args[1] || 22,
10
username: args[2] || 'karim',
11
password: args[3] || 'karimos',
12
algorithms: {
13
hmac: ['hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1', 'hmac-sha1-96']
14
}
15
16
};
17
Advertisement
Answer
I also had the same problem and solved it by adding the following:
JavaScript
1
32
32
1
algorithms: {
2
kex: [
3
"diffie-hellman-group1-sha1",
4
"ecdh-sha2-nistp256",
5
"ecdh-sha2-nistp384",
6
"ecdh-sha2-nistp521",
7
"diffie-hellman-group-exchange-sha256",
8
"diffie-hellman-group14-sha1"
9
],
10
cipher: [
11
"3des-cbc",
12
"aes128-ctr",
13
"aes192-ctr",
14
"aes256-ctr",
15
"aes128-gcm",
16
"aes128-gcm@openssh.com",
17
"aes256-gcm",
18
"aes256-gcm@openssh.com"
19
],
20
serverHostKey: [
21
"ssh-rsa",
22
"ecdsa-sha2-nistp256",
23
"ecdsa-sha2-nistp384",
24
"ecdsa-sha2-nistp521"
25
],
26
hmac: [
27
"hmac-sha2-256",
28
"hmac-sha2-512",
29
"hmac-sha1"
30
]
31
}
32