Add sshpass to the supervised / docker container

For some automations it is necessary to use scripting. For ease of use I usually rely on sshpass. Unfortunately this is not part of the base package of most docker containers. E.g. I use sshpass for switching on my TV with a remote CEC command send to my RPi with Kodi via a script from HA:

#!/bin/bash
sshpass -p ‘your_password’ ssh -o StrictHostKeyChecking=no root@ip_of_your_kodi ‘(echo “standby 0” | cec-client -s -d 1)’

The script is activated by a button in HA, issuing the command remotely on the Kodi device. Same for switching off the TV or checking the status: ‘(echo pow 0 | cec-client -s -d 1) | grep "power status: "’

For this, I need sshpass in a HA docker container / supervised install. Currently I connect to the container and use:

apk add --update --no-cache sshpass

to install sshpass after every update. Would be great if it would be “on board” as standard. Helpful bash_scripts are TV status/switching, activating PoE on ports of a Unifi switch (e.g. ‘(echo “enable” ; echo “configure” ; echo “interface 0/15” ; echo “poe opmode auto” ; echo “exit” ; echo “exit” ; echo “exit”) | telnet localhost ; exit;’ - currently just working on Unifi Gen1 switches) and many more. Would be appreciate if sshpass could be integrated in the standard docker container for HA.

Hi, I have the same request. Did you ever find out how to do this?

The exact same thing happens to me. I have a bash script to connect via ssh to my firewall and restart it, all automatically from HA. The problem is that everything was working fine until last week I updated the HA core. every time I upgrade the HA core I have to go through these steps again.

Go to Settings → plugins → Advanced SSH & Web Terminal → Uncheck protection mode → reboot

Go to Terminal →

docker ps -a

(look for the CONTAINER ID of the Docker container which is called homeassistant and its IMAGE is [Package qemux86-64-homeassistant · GitHub](http ://ghcr.io/home-assistant/qemux86-64-homeassistant:2024.5.4))

sudo docker exec -it CONTAINERID /bin/bash
apk add --update --no-cache sshpass
ssh -o KexAlgorithms=+diffie-hellman-group1-sha1 -o HostKeyAlgorithms=ssh-dss,ssh-rsa -t [email protected]

yes

Type password

exit

Go to Settings → Add-ons → Advanced SSH & Web Terminal → Check protection mode → reboot