Execute in Home Assistant Container Context

Hi, I have some issues executing a shell script and I would like to follow this advice but… not sure how to get into the Home Assistant Container. I am not using Docker. Can anyone suggest how I do this?

While technically about ssh’ing, this guide will cover what you’re looking for.

Hi Mike - I got it to work but still interested to figure out how you actually end up in that Home Assistant Container context as it would have saved me a lot of time. Thanks for your offer to document it for the next person though.

Oh that was basically the testing your command section.

The TL;DR is this:

  1. Turn on advanced mode for your user (if you don’t have that turned on already)
  2. Install the SSH & Web Terminal addon (the one in community add-ons not the official one)
  3. Disable protection mode on the ssh add-on and start it
  4. While ssh’ed (or from the web terminal) enter docker exec -it homeassistant bash
  5. Do whatever command you’re trying to test, you’re now in the HA container

Thanks @mike

I’m not sure how to “Disable protection mode” and can’t find that option. Also, I don’t seem to have a docker command “command not found”.

This option on the first tab of the addon.

Right, because you have protection mode enabled. That’s what disabling protection mode does, gives access to the docker cli which allows you to potentially make unsafe and unsupported changed to the system. Not that the command I’m suggesting is unsafe just that’s why it’s called protection mode.

1 Like

Warning so you don’t waste time like I did. Now it is necessary to install the plugin “Advanced SSH & Web Terminal” to have access to the protected zone.

3 Likes