Passwordless SSH throws an error in Exec Node

Hi Community –

I followed a guide to generate and install keys to a remote server from Home Assistant. When I use the root user in Terminal, HA SSH connects to the remote server without any issues. In Node Red Exec Node, it throws the following error:

Permission denied, please try again. Permission denied, please try again. [email protected]: Permission denied (publickey,password).

Any suggestions?

When you connected from root in the terminal you were probably asked to accept a key.
You need to accept that key for the Node Red user too, but I have no idea how that is done.

Thanks for your reply. Any idea what the Node RED user is? Is it different to root?

As wally was saying node red is in a separate container from ha. The keys you set in has won’t work for NR.

How i get around this is i create a script in ha that calls the shell command. Then execute the script from node red.

Thanks @Mikefila – is there a way to get the response from the shell script into Node RED for further manipulation? I am trying to get the free disk space of a remote server, so I want to get the % into HA.

I just use it to reboot pi’s so I never set up a return. I believe you can use a commend line sensor in HA to get the return value, then it’s like any other sensor

Phenomenal help, thanks @Mikefila. I wasn’t even aware of such a command. One step closer to what I want to achieve now… Here’s another issue: although the ssh command runs successfully in Terminal in HA, the command fails when I runs as a command_line sensor. Logs aren’t particularly helpful. Any ways to test this?