How to get access at damn host system?

If you want access to the host the easy way

Make an ssh key on your current desktop

Add this addon to your repositories

Install the Add-on. Paste your public key in the configuration of the add on. Start the add on. Reboot twice. Uninstall the addon

Open up terminal and

ssh [email protected] -p 22222

You’ll have system access in less than 5 minutes. Good luck.

You wanna do some nmcli stuff for vlans and such. Follow this after

Hi!

just replying to this thread if someone wants a simple solution. Also for my own reference :wink:

This is in the category “this works for me” when using Home-Assistant OS and SSH & Web Terminal addon.

  1. disable protection mode from SSH & Web Terminal addon
  2. restart SSH & Web Terminal addon
  3. ssh to homeassistant
  4. docker exec -it homeassistant /bin/bash

Host’s own processes don’t show with ps but the filesystem is accessible

That is not access to the host

Very helpful - but…
When I go to “login” from the ha> prompt from the console - I get nothing. BUT
When I ssh into my system (RPi4) and I type docker ps, I get this:
root:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
51c2e4643ee5 Package ssh/aarch64 · GitHub “/init” 5 minutes ago Up 5 minutes addon_a0d7b954_ssh
2b730c513c0b homeassistant/aarch64-addon-mosquitto:6.3.1 “/init” 6 minutes ago Up 6 minutes 0.0.0.0:1883-1884->1883-1884/tcp, :::1883-1884->1883-1884/tcp, 0.0.0.0:8883-8884->8883-8884/tcp, :::8883-8884->8883-8884/tcp addon_core_mosquitto
9a0c5510512c ghcr.io/home-assistant/aarch64-hassio-multicast:2023.06.2 “/init” 6 minutes ago Up 6 minutes hassio_multicast
d046633f4242 ghcr.io/home-assistant/aarch64-hassio-audio:2023.06.0 “/init” 6 minutes ago Up 6 minutes hassio_audio
2d898d612c22 ghcr.io/home-assistant/aarch64-hassio-dns:2023.06.2 “/init” 6 minutes ago Up 6 minutes hassio_dns
d17595c2a702 ghcr.io/home-assistant/aarch64-hassio-cli:2023.06.0 “/init” 6 minutes ago Up 6 minutes hassio_cli
c159f343cdb3 ghcr.io/home-assistant/raspberrypi4-64-homeassistant:2023.9.2 “/init” 58 minutes ago Up 5 minutes homeassistant
f5703ba0ad2c ghcr.io/home-assistant/aarch64-hassio-supervisor:latest “/init” 3 hours ago Up 6 minutes hassio_supervisor
3f7767e7e8b2 ghcr.io/home-assistant/aarch64-hassio-observer:2023.06.0 “/usr/bin/observer” 3 weeks ago Up 6 minutes 0.0.0.0:4357->80/tcp, :::4357->80/tcp

Which tells me that the ssh is the base OS and the console is the docker container.

???

Hi Hap - well, it’s four years since I wrote that post, and 4 years is a very long time in HA! Many things may have changed, including the most common ways people run the system.

For what it’s worth, and in case any of this is useful to others, I’m now running mine using the standard x86 configuration of the HA OS on an Intel-NUC-type device. I’m actually running it in a virtual machine under Proxmox, because it was too much hassle to overwrite the hard disk at the time, but I think it is much the same as if I were running it directly on the bare metal.

In this configuration, there isn’t an SSH daemon running in the top-level OS. (I don’t know if that’s the same on the standard Raspberry Pi OS image - it sounds as if yours does have one running.) The console of the VM shows me the HA console program, and I can type ‘login’ there to get to the host (though I note that this still isn’t listed in the available commands).

I have the ‘Terminal and SSH’ add-on installed, which allows ssh connections from outside to port 8022, and it, like other add-ons, is a Docker container, so when I ssh into it, I’m inside that container. This is the same place that you end up if you go to the Add-On’s page itself and click ‘Open web UI’ to get a terminal.

In that world, some useful things like the config, addons and backups directories are mounted in the root directory as /config etc. There are also symbolic links to them in the root user’s home directory, so if you log in and just do ls, you get a nice list:

[core-ssh ~]$ ls
addons  backup  config  share   ssl

[core-ssh ~]$ ls -l
total 0
lrwxrwxrwx    1 root     root             7 Sep  2 18:20 addons -> /addons
lrwxrwxrwx    1 root     root             7 Sep  2 18:20 backup -> /backup
lrwxrwxrwx    1 root     root             7 Sep  2 18:20 config -> /config
lrwxrwxrwx    1 root     root             6 Sep  2 18:20 share -> /share
lrwxrwxrwx    1 root     root             4 Sep  2 18:20 ssl -> /ssl

Lastly, the ha command-line tool is available, which lets you do various things from this ssh connection much as you would from the console itself, but not everything: several commands I tried gave me permission errors. (My understanding is that this ha client is connecting to the endpoint provided by the supervisor container.)

But I don’t think there’s a way from this ssh session to escape from the container and get to the parent host: I wouldn’t expect one. I think the only way to do that at present on a standard HAOS install is to go to the machine’s console and type ‘login’, or to set up an SSH server on the host itself.

Q

1 Like

Thanks for the info - I’ve done a bit of looking since then. HA is a strange beast. I don’ really want to learn a whole new world just for HA - I’ve got so many other things running on a common Linux base.

ALL I want to do is to have HA access my AD2USB module, which is remote sunning ser2net. Which means I need to run socat on HAOS. I’ve found GitHub - vladbabii/homeassistant-socat: Home Assistant with socat for remote zwave but do I really need to load a new system just to add socat? This seems quite silly.

Anyway - I choose HA because all the other systems use cloud or lock you out of doing things JUST LIKE THIS. HA is very well supported and I like it so far, but dang… they make it easy to write cards but not to make the cards useful by adding and access the proper system level components.
Oh well.

apk add socat

Do this in the advanced ssh addon. You can make sure it is always installed in the addon settings.

I’m guessing the best way might be to run socat on the host system, exposing your device as a local device, and then arrange for that to be mounted into the Home Assistant container. (I am away from base and on my phone so I won’t offer to look up how to do that :-))

Though I guess it depends whether the integration you plan to use with it can find the device that way. I haven’t used socat for this (and I am not familiar with AD2USB), so I don’t know how well it will be able to emulate the remote device characteristics.

Or, if you find the HAOS system too constraining, you can always run HA yourself on the host system, or using your own docker-compose file…