1

我正在使用使用 ssh2 npm 包的 remote-exec,我收到以下错误

错误:等待握手时超时

我正在运行的代码如下

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!!');
    }
});

显然我已经更改了用户名、密码和 IP,但您应该能够理解。

我试图查看类似的问题,但从我所看到的情况来看,没有一个有很好的工作答案。

谢谢!

4

0 回答 0