Wednesday, 17 May 2017

nodejs - Error: Timed out while waiting for handshake

I am using remote-exec which uses the ssh2 npm package and I am getting the following error

Error: Timed out while waiting for handshake

The code which I am running is the following

var rexec = require('remote-exec');

// see documentation for the ssh2 npm package for a list of all options
var connection_options = {
    port: 22,
    username: 'username',
    passphrase: 'password'
};

var hosts = [
    '10.101.10.101'
];

var cmds = [
    'ls -l'
];

rexec(hosts, cmds, connection_options, function(err){
    if (err) {
        console.log(err);
    } else {
        console.log('Great Success!!');
    }
});

Obviously I have altered the username, password and IP but you should be able to get the idea.

I have tried to look through similar questions but there are none which have a good working answer from what I can see.

Thanks!



via Alex Johnston

No comments:

Post a Comment