This took a surpising amount of digging to find… I needed to debug a command_line switch that wasn’t working as expected in hass.io so I wanted a shell on the actual environment. It’s pretty simple once you actually figure out how…
- Shut down your pi and put the SD Card in your computer.
- Create a file in the resinos-boot partition called authorized_keys and put your ssh public key in it.
- Put the SD Card back in your pi and start it up.
- Run this SSH command:
ssh -t root@hassio -p 22222 “docker exec -it \$(docker ps -f name=homeassistant -q) bash”
If you’re on windows first putty to root@hassio port 22222 then run
docker exec -it $(docker ps -f name=homeassistant -q) bash
You can substitute the name of addons where you put name=homeassistant to get into them instead. To get a full list of containers you can just run “docker ps”
UPDATE: This post was originally written with respect to resinOS hassio, newer hassio now uses HassOS. The following proceedure should still get you the same thing.
- Follow the instructions here to add your ssh key https://developers.home-assistant.io/docs/en/hassio_debugging.html#hassos-based-hassio
- ssh root@hassio -p 22222
- At the hassio > prompt run “login”
- At the shell prompt you can run docker commands such as: “docker exec -it $(docker ps -f name=homeassistant -q) bash” which will get you a shell inside the homeassistant container.