I tried changing the private key format using the command ssh-keygen -m PEM -p -f ~/.ssh/id_rsa, but I am still getting the same error. For now, I am trying to connect with my system only. I don't understand what's wrong I am doing.
ssh.connect({
host: process.env.SSH_host,
username: process.env.SSH_user,
privateKey: process.env.SSH_privatekey,
passphrase: process.env.SSH_passphrase
})
.then(() => {
console.log("ssh connected");
ssh.execCommand('redis-cli ping', { cwd: '/var/www' }).then((result) => {
console.log('STDOUT: ' + result.stdout);
console.log('STDERR: ' + result.stderr);
});
});