0

I can connect to ssh2 without the privateKey I am trying to enter a server with SFTP but when I get the following error ...

Timed out while waiting for handshake

I'm looking for an example and almost everyone uses the privateKey, is it mandatory? and how is one generated?

My code is the following ...

var Client = require ('ssh2'). Client;
var conn = new Client ();

conn.on ('error', function (err) {
    console.log ('SSH - Connection Error:' + err);
});

conn.on ('end', function () {
    console.log ('SSH - Connection Closed');
});

conn.on ('ready', function () {
    console.log ("------ enter ------");

    // code to work with SSH
});
conn.connect ({
    host: 'host',
    username: 'user',
    port: 22
    password: 'password',
});
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
carlos
  • 1
  • 2
    It's up to the server to decide whether they accept password authentication or private key only, but this message is indicating a problem before that point. You're sure you have the host name correct, and that it has an ssh server? Can you ssh in from a command line? – Tim Roberts Mar 12 '21 at 00:34
  • yes, I can connect by filezilla to the server, as such I have not tried it by command line – carlos Mar 12 '21 at 17:35

0 Answers0