Same here. I have a simple command to sleep my iMac which runs fine from hassio shell but not from UI toggle. I think it has to do with Hass being in docker but I can’t get into the container’s shell either as the containers aren’t actually listed in Portainer.
create a key with ssh-keygen and then copy ssh-copy-id [email protected] to the target system using ssh-copy-id.
After that you can log in to the console without a password on the foreign system and you can do that in Home Assistant commands scripts via SSH
THIS MIGHT NOT BE BEST SECURITY PRACTICE!
But i got it working like this: command: "/usr/bin/ssh -i /config/ssh/id_rsa -o UserKnownHostsFile=/config/ssh/known_hosts user@host 'remote_command'"
after i copied my id_rsa and known_hosts files in the locations in the config folder, so homeassistant has access to it.
Now i am not too familiar with permission stuff. So if anyone more qualified could comment further on the security implications of this, i’d appreciate it.