🆕[add-on] HassOS SSH port 22222 Configurator

Those block devices probably don’t exist in a KVM/libvert environment. Hence the addon does not know where to save the key.

OK, thanks. So does the Port 22222 Configurator not work in KVM/libvirt? Is there any work around?

If I can’t get Port 22222 Configurator to work, is there ANY other option other than the “Import from USB” option or is that it?

Thanks!

I am not au fait enough with kvm to know for sure.

Using ssh to home assistant container, what does the mount comand return? Use ssh& web terminal addon.

@nickrout Here is what I get… Thanks!

~ $ mount
overlay on / type overlay (rw,relatime,lowerdir=/mnt/data/docker/overlay2/l/V3MQI5VMTJK63JZQBG4AYYQDEY:/mnt/data/docker/overlay2/l/XZ3BENCKCWTMDOBQMCXLD4QP4G:/mnt/data/docker/overlay2/l/ZZS65CA6HZTC45HQFJU63CKSFC:/mnt/data/docker/overlay2/l/WK3PIECNPUTZFJEYPJIML7IXDA:/mnt/data/docker/overlay2/l/JM6WQLLG3FTK2VXDOHHRA2FCFD:/mnt/data/docker/overlay2/l/XNDID7BZD4HU3NRL3MBF7W2SUO:/mnt/data/docker/overlay2/l/6TCT67HJKBI3LHQDTX7XO2SM5G:/mnt/data/docker/overlay2/l/22BRIONPYBAPJ6XBYO5Q4Q2PFQ:/mnt/data/docker/overlay2/l/PTUEA3JBSDADVPFEGLEVIIJVM5,upperdir=/mnt/data/docker/overlay2/ad5343f58260ff763ee46403f3e942bb2adadb536660121690ecbc75b0cd7a29/diff,workdir=/mnt/data/docker/overlay2/ad5343f58260ff763ee46403f3e942bb2adadb536660121690ecbc75b0cd7a29/work)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,name=systemd)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
/dev/vda8 on /addons type ext4 (rw,relatime)
/dev/vda8 on /backup type ext4 (rw,relatime)
/dev/vda8 on /media type ext4 (rw,relatime)
/dev/vda8 on /ssl type ext4 (rw,relatime)
devtmpfs on /dev type devtmpfs (ro,relatime,size=1494360k,nr_inodes=373590,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
/dev/vda8 on /data type ext4 (rw,relatime)
/dev/vda8 on /config type ext4 (rw,relatime)
/dev/vda8 on /share type ext4 (rw,relatime)
/dev/vda8 on /run/audio type ext4 (ro,relatime)
/dev/vda8 on /etc/asound.conf type ext4 (ro,relatime)
tmpfs on /run/dbus type tmpfs (ro,size=598524k,nr_inodes=819200,mode=755)
/dev/vda8 on /etc/hosts type ext4 (rw,relatime)
/dev/vda8 on /etc/resolv.conf type ext4 (rw,relatime)
/dev/vda8 on /etc/hostname type ext4 (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/vda8 on /etc/pulse/client.conf type ext4 (ro,relatime)
proc on /proc/bus type proc (ro,relatime)
proc on /proc/fs type proc (ro,relatime)
proc on /proc/irq type proc (ro,relatime)
proc on /proc/sys type proc (ro,relatime)
proc on /proc/sysrq-trigger type proc (ro,relatime)
tmpfs on /proc/asound type tmpfs (ro,relatime)
tmpfs on /proc/acpi type tmpfs (ro,relatime)
devtmpfs on /proc/kcore type devtmpfs (ro,relatime,size=1494360k,nr_inodes=373590,mode=755)
devtmpfs on /proc/keys type devtmpfs (ro,relatime,size=1494360k,nr_inodes=373590,mode=755)
devtmpfs on /proc/timer_list type devtmpfs (ro,relatime,size=1494360k,nr_inodes=373590,mode=755)
tmpfs on /proc/scsi type tmpfs (ro,relatime)
tmpfs on /sys/firmware type tmpfs (ro,relatime)

@adamoutler

Same problem on an Intel NUC with an SSD drive, that is not mounted as sda1 sdb1 but like this:

/dev/nvme0n1p8 on /share type ext4 (rw,relatime)
/dev/nvme0n1p8 on /config type ext4 (rw,relatime)
/dev/nvme0n1p8 on /backup type ext4 (rw,relatime)
/dev/nvme0n1p8 on /addons type ext4 (rw,relatime)
/dev/nvme0n1p8 on /data type ext4 (rw,relatime)
/dev/nvme0n1p8 on /ssl type ext4 (rw,relatime)
/dev/nvme0n1p8 on /media type ext4 (rw,relatime)
/dev/nvme0n1p8 on /etc/asound.conf type ext4 (ro,relatime)
/dev/nvme0n1p8 on /run/audio type ext4 (ro,relatime)
/dev/nvme0n1p8 on /etc/hosts type ext4 (rw,relatime)
/dev/nvme0n1p8 on /etc/hostname type ext4 (rw,relatime)
/dev/nvme0n1p8 on /etc/resolv.conf type ext4 (rw,relatime)
/dev/nvme0n1p8 on /etc/pulse/client.conf type ext4 (ro,relatime)
/dev/nvme0n1p8 on /var/log/journal type ext4 (ro,relatime)

These are the partitions:

nvme0n1                                    232.9G KINGSTON SA2000M8250G
├─nvme0n1p1                                   32M
├─nvme0n1p2                                   24M
├─nvme0n1p3              /sbin/docker-init   256M
├─nvme0n1p4                                   24M
├─nvme0n1p5                                  256M
├─nvme0n1p6                                    8M
├─nvme0n1p7                                   96M
└─nvme0n1p8              /var/log/journal  232.2G

Would be good to have this addon working also in non-standard cases like this. Maybe a configuration option to specify the partition would be a good idea, unless there’s a way to retrieve it automatically.

Thanks for any help on this.

Hi,

I gave this addon a go today but eventually ended up uninstalling it again. Somehow it’s not completely removed :frowning:
Now when i want to start Terminal & SSH addon i get the error that Port 22222 is alread in use…
Is there anything i can do to remove the last traces of this addon? I restored a full snapshot from 3 days ago but the problem is still there.

Hello,

I’m having difficulty getting this add-on to work. I have protection mode off, I have rebooted the host multiple times via the supervisor, I have entered in the public key enclosed in quotes, but I still get a connection refused error. I’m using an ODROID-N2+, and this is my information under system health: |Version|core-2021.8.6|
|Installation Type|Home Assistant OS|

This is in my log:

Blockquote
[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] done.
[services.d] starting services
[services.d] done.
nothing to do. I can’t find a /dev/sda1, /dev/sdb1, /dev/mmcblk0p1 or /dev/nvme0n1p1
[cont-finish.d] executing container finish scripts…
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I was able to use putty to connect to port 22 using the public/private key so I think that part is working fine.

probably easiest to create a pub/priv key pair on linux, make sure to use rsa i had an issue using ecdsa.

turn off protection mode, add key with addon stopped. start addon. It should say created keys. Then you can login. Hoorah.

I wasn’t going to bother with this, i was just consoling in to the hassos vm then running a shell script in /mnt/data to mount cifs to /mnt/data/supervisor/media everytime I did a HASSOS reboot. (rare).
Then I passed through my CPU/GPU for ffmpeg and was blindly typing into a non-responsive console to run said shell script… :rofl:

This addon makes it much cleaner now and only requires one attempt :stuck_out_tongue: thank you very much.

Now if only I could put a command somewhere to run when HASSOS boots…?

Oh my god. Can someone help me please. I have NO IDEA about keys. I just want to disable IPv6 (which I wish never existed). I have used puttygen to create a key but I simply have no idea which bit to cut and paste. And whats the root@Ha_xxx in the config file? Do I modify that? delete it? Sorry, I know Im a noob but I really wish I didn’t have to be a cybersecurity expert just to turn a lightbulb off. Any understanding help appreciated.

I would recommend using WSL to generate the key, and also read up on ssh keys. There are many explanations on the net.

The root@Ha_xxx is part of the key. Once you have generated the key it will be part of the id file

Specifically (in WSL):

ssh-keygen -t rsa -b 4096

The program will prompt you to choose where to put the key files. It will probably be C:\Users\you\.ssh. Once the program finishes cd to that directory and the files will be there. On my system

cd C:\Users\OEM\.ssh
ls

system responds

    Directory: C:\users\oem\.ssh


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        13/09/2021   5:49 PM           3389 id_rsa
-a----        13/09/2021   5:49 PM            746 id_rsa.pub

The file you want is the .pub file.

cat id_rsa.pub

system responds (and I have obfuscated parts of this)

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDohEc+C96Dgn8Kt3691Tvt0Rp6kQ4IhChQ44orbvaPBohWa1WobxhwswlCC7Ws6KaRztyPDcAPVQr4NE+xSFHhrRAE/GzKMNRBrHem3KCUeyLlSDsCq05We5VVwXJ198ffpqSWPAGIL+MV/2m8bRpzJCesD8A3jnuhuxrcyLptgqILiIde6Pzi/uz87qzIyFBNLBn36jjRNDsXsQ6ZrnVM1csg8M11+v/a/udKcwW+vxMgIKXatB/jq0JV6DLp1mJrP6osFLdsCNDJ/iweyfdxhSwfEZ1tm/diR0EkCvhPhFT4j+vY6Jyha50iM6NH7TUR+K8oavVdlFQ2Rk8eONB+R2ekz3vyOUzy5sYgBk/OhDFawl6D6iWDyB5lv/Guiaq62D7biUS7YUlCddhErp55WVoBbjoeAmhFnGxxxxxxxxxxxxxxxBCN1wufLCE6ozs886U9MEdWAt3pBUv4BRYouTIIEW2FMQrSyEqRBCqETftYuFAWZRLOSziHMVESbQ3k5aPzzX4EZFrj0Z/tF+z8cELD30dKTg48zW6/DteNizu3dI0GhjaJOgsA/1Pnf7EuJVm1wfMahWiAP0CkiZ722P0yCb6gYntRUkHI7l6aPaSNMFrYjVwtSuITMJgcthrE0fkq4k0r6Wgkyyf2RLmjovvQ+VBrKW7f7Edi/Q== oem@xxx

Simply copy and paste into the addon.

1 Like

I love the idea of this add-on. I followed the official HA developer guide to create a public/private key but couldn’t get it to work. Then installed this add-on, but still no luck. When trying to ssh to port 22222 I’m getting error “Connection refused”.

This is what the logs of the add on show:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
no vda1 config found
no sda1 config found
no sdb1 config found
no mmcblk0p1 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.

I’m running HA on an Odroid N2+. Any suggestions on how to troubleshoot/fix?

What are your disk mounts?

[core-ssh mnt]$ df -aTh
Filesystem           Type            Size      Used Available Use% Mounted on
overlay              overlay        56.6G      9.5G     44.8G  18% /
proc                 proc               0         0         0   0% /proc
sysfs                sysfs              0         0         0   0% /sys
tmpfs                tmpfs           1.9G         0      1.9G   0% /sys/fs/cgroup
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/systemd
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/cpuset
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/net_cls,net_prio
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/blkio
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/pids
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/devices
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/perf_event
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/freezer
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/hugetlb
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/memory
cgroup               cgroup             0         0         0   0% /sys/fs/cgroup/cpu,cpuacct
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /data
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /share
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /ssl
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /addons
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /backup
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /media
devtmpfs             devtmpfs        1.7G         0      1.7G   0% /dev
tmpfs                tmpfs           1.9G         0      1.9G   0% /dev/shm
devpts               devpts             0         0         0   0% /dev/pts
hugetlbfs            hugetlbfs          0         0         0   0% /dev/hugepages
mqueue               mqueue             0         0         0   0% /dev/mqueue
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /config
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /run/audio
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /etc/asound.conf
tmpfs                tmpfs         763.5M      1.4M    762.1M   0% /run/dbus
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /etc/hosts
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /etc/resolv.conf
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /etc/hostname
tmpfs                tmpfs           1.9G         0      1.9G   0% /dev/shm
/dev/mmcblk1p4       ext4           56.6G      9.5G     44.8G  18% /etc/pulse/client.conf
proc                 proc               0         0         0   0% /proc/bus
proc                 proc               0         0         0   0% /proc/fs
proc                 proc               0         0         0   0% /proc/irq
proc                 proc               0         0         0   0% /proc/sys
proc                 proc               0         0         0   0% /proc/sysrq-trigger
tmpfs                tmpfs           1.9G         0      1.9G   0% /proc/asound
devtmpfs             devtmpfs        1.7G         0      1.7G   0% /proc/keys
devtmpfs             devtmpfs        1.7G         0      1.7G   0% /proc/timer_list
tmpfs                tmpfs           1.9G         0      1.9G   0% /sys/firmware

I suggest an issue on the author’s github.

Thanks. Done.

1 Like

Hello @marcvl64

i have got the same problem like you,

i follow the doc…but in the HassOs22222 AddOn i put the wrong key.

In config/.ssl/ you have the id_rsa.pub and this is the key you need to paste in the “configuration” part of this AddOn. this key finish by “root@a0d7b954-ssh”.

I have the ssh and web terminal AddOn from @frenck and its not the same key, its end with “rsa-key-20190824”

i think the key for HassOs AddOn need to be create by root user, i follow this link if i remember well…https://help.github.com/articles/connecting-to-github-with-ssh/

hope it helps

No, @marcvl64’s problem is fixed.

Nice for him :smile: