I need help to make an ssh connection on a machine with nodeJs, I need to use this command first after logging in "sudo /usr/bin/rootsh -i -u root" and then go in this path "cd .." + "cd u01/scripts/" + "cat output.txt" only giving an error
connect = require("ssh2-connect");
exec = require("ssh2-exec");
connect(
{
host: "XX.XX.XXX.XX",
username: "XXXXXXXX",
password: "XXXXX",
},
function (err, ssh) {
child = exec(
{
command:
"ssh -qtt username@host -- sudo /usr/bin/rootsh -i -u root; cd ..; cd u01/scripts/; cat saida.txt",
ssh: ssh,
},
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
console.log(err);
}
);
}
);