Remote ssh command: error 255

Hi, I see I’m not alone with SSH commands not working from HA GUI but I also don’t see a working solution. Goal is to set an automation to reboot an ASUS router in the morning.

Problem: shell commands DO work from Terminal addon but DO NOT work from HA GUI or automations.

ssh [email protected] /sbin/reboot

I’m getting this:

ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `ssh -o "StrictHostKeyChecking=no" [email protected] /sbin/reboot`, return code: 255
NoneType: None

RSA key pair is pasted to the router’s web admin. I understand HA and Terminal addon are probably two different users with different credentials but I don’t know how to fix it.

ssh -o "StrictHostKeyChecking=no" [email protected] /sbin/reboot
ssh -i /data/.ssh/ [email protected] /sbin/reboot
ssh -i /data/.ssh/id_rsa [email protected] /sbin/reboot
ssh -i /root/.ssh/ [email protected] /sbin/reboot
ssh -i /root/.ssh/id_rsa [email protected] /sbin/reboot

Rpi4 with HA Core 0.108.5 via Ethernet directly into router
AC-1200 router

Please advise, thanks.

I’ve used Shortcuts on iOS to do this as it can run remote shell commands with passwords now but I’d still like a HA solution.

Not what you might want to hear, but I am in the same boat here. I am attempting to reboot a remote raspberry pi with the shell commands without much success.

same problem here.

I managed to figure it all out.

First, you need to use SSH & Web Terminal which can be found on the Home Assistant Community Add-ons.
This lets you log on to the home assistant host (I think?)
Then i created the SSH keys from there and copied them onto the rasberry pi.
I then used this shell command to send commands to the pi.

picommand: ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] '[remote command to be run]'

I hope this helps, i should have documented what i did to get it working before i forgot. The key way to use the community SSH add on and not the official ssh add on.

I just wanted to write down the same :smiley: I solved it a 10 minutes ago. The same method I used.

1 Like