How to execute SSH commands on another linux server via node-red (e.g. for update)

I had that same question.
Basically, I wanted to shutdown a linux pc in the kitchen (showing the HA dashboard) at night or when nobody is home. Solved it just like @spiegeljb, but had a problem after updating homeassistant: I had to login via ssh from HA to the pc manually once because HA forgot the rsa fingerprint. With a little tweak, login now works flawlessly every time.

configuration.yaml entry:

shell_command:
    pc_kitchen_shutdown: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/ssh/id_rsa [email protected] 'shutdown -h now'"

I avoided using sudo by setting the SUID bit for /sbin/shutdown on the kitchen pc. (see here or here on how to do that )

I call this from Node Red with a “call service” node. Node Red even shows you a list of possible entity ids when you start typing “shell” in the respective field.
Please note that theoretically, this is a security risk since it basically cripples the rsa fingerprint functionality and an attacker could impersonate the kitchen pc.
Since the user ssh-ing in is local to the kitchen pc and not priviliged, the pc in the kitchen does not hold any valuable data, does not receive any traffic besides that for the dashboard and traffic from and to this pc is limited to my cabled home network, I can live with that.