Exec node choking on the following command sequence?

I have setup public/private key methodology for use with SSH. This is the typical implementation, create the key pair, push the public key to the remote host. Old school to be sure..

ssh-keygen -t rsa
ssh-copy-id myname@somehost

Then I try to run a command via an exec node.

ssh root@pizero0.nuts.org systemctl restart nodered

At the CLI in a terminal window on a Linux system this works just fine. It is only when I try to execute it in an exec node I get the following...

Command failed: ssh root@pizero0.nuts.org systemctl restart nodered
Permission denied, please try again.
Permission denied, please try again.
root@pizero0.nuts.org: Permission denied (publickey,password).

And the return code is 255. Is the exec node parsing something wrong? Not sure why this is failing, when it works fine from the CLI.

And before someone asks, whey not just send the command over MQTT to the remote system and then use exec node in local environment to run the command? Well, given the nature of the commands that may be run, I can't rely on the broker being active.

Try runningpwd rather than systemctl. That will tell you whether it is the access to the server or the command that is the problem. Also make sure the Append Payload checkbox is not set in the exec node.

And which user is Node-RED running as ? Same as CLI ?

oh CLI was not node, but just Linux CLI, ssh session, my bad, I should have clarified that. For now I side stepped the issue, and setup a client flow so I send the commands via MQTT, and then they execute in local context, without issue. It is only when I try to use a SSH public key authentication with an exec node on the local system, trying to execute on the remote system, again with SSH public key authentication, that I get the issue. I will come back to this in due course, because I do want to be able to avoid using the broker, if it is down for example, but for now, using the broker as a proxy if you will, works.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.