I need to send commands to a remote machine using SSH. I’ve installed the SSH add-on in Hassio (w/ supervisor) and from their generated a public key pair and pushed the key over to the remote server (see steps 1 -2: https://app.getpocket.com/read/1778265189). I can now commit commands to the remote server from the SSH web terminal without issue.
I’ve done the same as the pi/rasbian level, and again can send & execute commands on the remote server via the the local ssh terminal.
However, if I add these commands to my Hassio instance as shell_commands then run those commands via a button on the web-ui these fail with error code 250 or 255 showing in the Hassio log. This error relates to invalid permissions/credentials to run the ssh tasks on the remote server.
So, it would appear that Hassio is using a different user to perform shell_commands than the web terminal add-on and the [email protected] os level user. Which user is Hassio using to perform the shell_commands and how can I generate & push the public keys necessary to perform remote ssh actions?
Here’s an example of the type of shell command that I need to run on the remote server:
reboot_intercom_pi: ‘ssh [email protected] /usr/bin/sudo /sbin/shutdown -r now’