šŸ†•[add-on] HassOS SSH port 22222 Configurator

What sort of key pair? There is an issue with rsa keys I have found try an ed25519ā€¦

If youā€™re running HAOS, and you can visit the site on the ip.add.re.ss:8123, then once youā€™ve run this without protection mode, and physically rebooted the host, port 22222 will be opened for an ssh connection. If port 22222 isnā€™t opened and doesnā€™t respond to ssh ip.add.re.ss -p22222 then it likely didnā€™t have protection mode disabled.

Also you can check logs from the app to verify it worked. You can run this multiple times without consequence.

If that worked, and you power-off rebooted, then the key itself may not be supported by sshd on HAOS. An example, tested, working key, is in the settings by default as an example.

You could do ssh-keygen from a terminal app, on the device, and then use the resulting public/private key combo. Just ssh-keygen then cat ~/.ssh/id_rsa.pub and copy the results into the settings, start the app. Then cat ~/.ssh/id_rsa and copy your new public key to your computer, restart the HAOS device and after reboot connect with your new private/public key.

@adamoutler and @DavidFW1960 thanks (Interesting idea about the ed25519 key)
TLDR I have it working, and I understand where I broke it

As per Adams instructions, so as not to trash my existing id_rsa key pair which I use every day on my Mac, I used root:

ssh-keygen
#created the default keypair
cat <path>/id_rsa.pub

copy this single line into the config section - DONā€™T edit it in YAML
with protection mode disabled
started the add-on which showed in the log section

...
no sda1 config found
no sdb1 config found
creating authorized keys in mmcblk0p1 !
no mmcblk1p1 config found
no nvme0n1p1 config found
...

then developer > services > Home Assistant Supervisor: Reboot the host system
then it worked

bash-3.2# ssh  172.16.0.20  -p 22222
Welcome to Home Assistant OS.

Use `ha` to access the Home Assistant CLI.
#

I went back and re-did this with my existing rsa key, as a single line into the config section without using YAML as an editor, and it worked perfectly.

2 Likes

doesnt work in case HAAS is installed in VM (esxi)
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
no vda1 config found
no sda1 config found
no sdb1 config found
no mmcblk0p1 config found
no mmcblk1p1 config found
no nvme0n1p1 config found
This Configurator did itā€™s job. Perform a hard-power-off now. This configurator only works once and is no longer needed.

reboot - power off ā€¦
ssh: connect to host 10.0.1.104 port 22222: Connection refused

any idea how to access haas OS?
thanks

What are the drives named? ls /dev

but this is via ssh plugin to core ā€¦

[core-ssh ~]$ ls /dev/
autofs           loop4            shm              tty28            tty53            vcs3
block            loop5            snapshot         tty29            tty54            vcs4
bsg              loop6            snd              tty3             tty55            vcs5
btrfs-control    loop7            stderr           tty30            tty56            vcs6
bus              mapper           stdin            tty31            tty57            vcsa
char             mem              stdout           tty32            tty58            vcsa1
console          mqueue           tty              tty33            tty59            vcsa2
core             net              tty0             tty34            tty6             vcsa3
cpu              null             tty1             tty35            tty60            vcsa4
cpu_dma_latency  nvram            tty10            tty36            tty61            vcsa5
disk             port             tty11            tty37            tty62            vcsa6
dri              ptmx             tty12            tty38            tty63            vcsu
fb0              pts              tty13            tty39            tty7             vcsu1
fd               random           tty14            tty4             tty8             vcsu2
full             rfkill           tty15            tty40            tty9             vcsu3
fuse             rtc              tty16            tty41            ttyACM0          vcsu4
gpiochip0        rtc0             tty17            tty42            ttyS0            vcsu5
hpet             sda              tty18            tty43            ttyS1            vcsu6
hugepages        sda1             tty19            tty44            ttyS2            vga_arbiter
hwrng            sda2             tty2             tty45            ttyS3            vmci
input            sda3             tty20            tty46            ttyUSB0          zero
kmsg             sda4             tty21            tty47            urandom          zram0
log              sda5             tty22            tty48            usbmon0          zram1
loop-control     sda6             tty23            tty49            usbmon1          zram2
loop0            sda7             tty24            tty5             usbmon2
loop1            sda8             tty25            tty50            vcs
loop2            serial           tty26            tty51            vcs1
loop3            sg0              tty27            tty52            vcs2


Filesystem                Size      Used Available Use% Mounted on
overlay                  62.3G     18.9G     40.8G  32% /
tmpfs                   989.7M         0    989.7M   0% /sys/fs/cgroup
/dev/sda8                62.3G     18.9G     40.8G  32% /backup
/dev/sda8                62.3G     18.9G     40.8G  32% /share
/dev/sda8                62.3G     18.9G     40.8G  32% /addons
/dev/sda8                62.3G     18.9G     40.8G  32% /media
devtmpfs                987.5M         0    987.5M   0% /dev
tmpfs                   989.7M         0    989.7M   0% /dev/shm
/dev/sda8                62.3G     18.9G     40.8G  32% /config
/dev/sda8                62.3G     18.9G     40.8G  32% /ssl
/dev/sda8                62.3G     18.9G     40.8G  32% /data
/dev/sda8                62.3G     18.9G     40.8G  32% /run/audio
tmpfs                   395.9M      1.0M    394.9M   0% /run/dbus
/dev/sda8                62.3G     18.9G     40.8G  32% /etc/asound.conf
/dev/sda8                62.3G     18.9G     40.8G  32% /etc/hosts
/dev/sda8                62.3G     18.9G     40.8G  32% /etc/resolv.conf
/dev/sda8                62.3G     18.9G     40.8G  32% /etc/hostname
tmpfs                   989.7M         0    989.7M   0% /dev/shm
/dev/sda8                62.3G     18.9G     40.8G  32% /etc/pulse/client.conf
tmpfs                   989.7M         0    989.7M   0% /proc/asound
tmpfs                   989.7M         0    989.7M   0% /proc/acpi
devtmpfs                987.5M         0    987.5M   0% /proc/kcore
devtmpfs                987.5M         0    987.5M   0% /proc/keys
devtmpfs                987.5M         0    987.5M   0% /proc/timer_list
tmpfs                   989.7M         0    989.7M   0% /proc/scsi
tmpfs                   989.7M         0    989.7M   0% /sys/firmware

anyone any idea here? how to access OS inside VM?

1 Like

I donā€™t think you need support here. You should have a console available from the VM itself. You can log in directly and then use it. Alternatively you could generate a new ssh key, then copy the public key to authorized_keys and then sftp the private key out. Itā€™s just standard Linux with an HA prompt.

@adamoutler dont get itā€¦ its CLI / console is limited ā€¦ u cant do anything (almost) with it ā€¦ i have no clue how do u want to copy keys / where. ā€¦
i just cant get login into OS on top which HAS is running and i dont know understand why such a ā€œcomplicationā€ is here ā€¦ intentionally? for a what reason?

Do you get the HA> prompt? Thatā€™s the same thing in ssh. You can type login from there and youā€™re into Linux. From there you can access the system and use SSH/SFTP/SCP/cURL/Telnet/wget/netcat just like any other Linux system. If you want to configure ssh, they use dropbear, so just look at the instructions. Youā€™ve got a VM running on a computer so you already have access to everything. You can mount folders/drives and use the UI from your desktop. The RPI and others are a PITA as they are a standalone limited machine.

got you point
but when i scp a pub ssh key into /root/.ssh/authorized_keys ā€¦ it doesnt work :frowning:

the OS has ip address of hassio iface ā€¦ once i do ip a on OS?

The service needs to be started

my point is what ip should be used to ssh to HAAS OS
is that ip 172.xā€¦ of hassio iface ?

thx

The LAN IP. The others are for docker.

1 Like

@adamoutler yes seems i have to install setup dropbearā€¦
just wanted to install htop and it seems to be hard taskā€¦ as there is no apt etc manager ā€¦ and OS is extremely limited.

It doesnā€™t run debian, so it doesnā€™t have apt. You should be able to use apk.

hello, Iā€™m stuck in this step, can you please articulate how did you do this part?

Hello, I just found this tool? Do you know if this is still applicable in Sep 2022 Home Assistant 2022.09 ? Iā€™ve been trying to ssh to supervisor via root but unable to get it to work. I am using HASOS in proxmox 7 and tried different methods but no luck, I tried putty I tried linux method but cannot get the output you mentioned int his thread. any help would be greatly appreciated.

Yes. It works.

Homeassistant OS on a Pi4 here, running from SD card. added repo, installed addon, copy&pasted key, started addon, got this in the log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
no vda1 config found
no sda1 config found
no sdb1 config found
no mmcblk0p1 config found
no mmcblk1p1 config found
no nvme0n1p1 config found
This Configurator did it's job. Perform a hard-power-off now. This configurator only works once and is no longer needed.

When i look in ā€œTerminal & sshā€ addon, i do have /dev/mmcblk0p1 through p8. but there i cant mount them because im not root.

Any idea? Any help is much appreciated :slight_smile: