小编Pra*_*aju的帖子

sshpass 命令在 Node.js 中不起作用

我尝试sshpass使用 node.js spawn() 运行命令来自动化 ssh。但它会自动从命令行退出,没有任何错误。这是我使用的代码。

var tail = spawn("sshpass", ["-p", "test", "ssh", "-n", "test@xxx.x.xxx.xxx", "'cat testfile'"]);
tail.stdout.on("data", function(data) {
        readData(data);
});
Run Code Online (Sandbox Code Playgroud)

spawn node.js sshpass

5
推荐指数
0
解决办法
1109
查看次数

标签 统计

node.js ×1

spawn ×1

sshpass ×1