System information
Version core-2023.5.0
Installation Type Home Assistant Supervised
Development false
Supervisor true
Docker true
User root
Virtual Environment false
Python Version 3.10.11
Operating System Family Linux
Operating System Version 5.10.0-22-amd64
CPU Architecture x86_64
Configuration Directory /config
Home Assistant Cloud
Logged In false
Reach Certificate Server ok
Reach Authentication Server ok
Reach Home Assistant Cloud ok
Home Assistant Supervisor
Host Operating System Debian GNU/Linux 11 (bullseye)
Update Channel stable
Supervisor Version supervisor-2023.04.1
Agent Version 1.5.1
Docker Version 23.0.5
Disk Total 144.7 GB
Disk Used 8.9 GB
Healthy true
Supported true
Supervisor API ok
Version API ok
Installed Add-ons Studio Code Server (5.5.7)
I have a few bash scripts that I would like to initiate from HA. I started with a simple test.
That command is running inside the HA container, where /tmp is also inside the container. If you’re then looking for that file via ssh, which is yet another container, then you won’t find it. That same mindset applies to shell_command, command_line sensors, etc. - they run in the HA container with a completely different filesystem and only specific external directories are mounted from the host. If you want to check the side effect of your shell_command that way, use touch /config/zt1.txt and look for it in the /config directory.
As root on 172.30.33.1, I did:
ssh-keygen -t rsa
ssh-copy-id [email protected]
with the password for user1 on 192.168.2.11
Now, as root on 172.30.33.1, I can
ssh [email protected]
without the password for user1 on 192.168.2.11
Still logged in as root on 172.30.33.1, I can
ssh -l user1 192.168.2.11 “touch /tmp/zt1.txt”
without the password for user1 on 192.168.2.11
and I can see file /tmp/zt1.txt created on 192.168.2.11 by user1
On HA, I made the same change
shell_command:
script_117_001_test_1: ssh -l user1 192.168.2.11 “touch /tmp/zt2.txt”
Restarted HA, and clicked on the Button Card but there is no /tmp/zt2.txt created on 192.168.2.11
The /var/log/auth.log on 192.168.2.11 shows
sshd[1074]: Connection closed by 192.168.2.18 port 52538 [preauth]
where 192.168.2.18 is the debian system running HA
Is my “shell_command: ssh -l …” script running in another container?
Still trying to get this Button Card to now execute a bash script … now via ssh.