5

I have tried to run sshpass command using node.js spawn() to automate ssh. But it automatically exits from the command line without any error. This is the code I used.

var tail = spawn("sshpass", ["-p", "test", "ssh", "-n", "test@xxx.x.xxx.xxx", "'cat testfile'"]);
tail.stdout.on("data", function(data) {
        readData(data);
});
Toolkit
  • 10,779
  • 8
  • 59
  • 68

0 Answers0