🆕[add-on] HassOS SSH port 22222 Configurator

Thanks, just a silly question how could I execute this command " systemctl", when I tried from within a container, I got an error saying command doesnt exist…

You can create a new container, privileged, and mount your /sys,/proc,/dev,/etc and others until you build a replica of the things you need, on an alpine container and then use whatever you need from there. It won’t be easy.

Which container are you in?

If you are logged in to the OS (which this addon enables) then you can run systemctl.

Inside containers, it frankly depends on how the container is built.

In any event, you are getting off topic in this thread,

Just here to say thank you for making this so simple for that very rare odd occassion that I need to jump into the supervisor.

2 Likes

Running Home assistant OS in VirtualBox over Windows11
Trying to gain root access so I can modify some files in the Zigbee2MQTT addon

ex. commands to be run are:

docker exec -it $(docker ps | grep zigbee2mqtt | cut -d" " -f 1) /bin/sh

vi node_modules/zigbee-herdsman-converters/converters/toZigbee.js

docker restart $(docker ps | grep zigbee2mqtt | cut -d" " -f 1)

I installed the HassOS SSH port 22222 Configurator and it worked as expected
then copied public key in SSH addon

but still couldn’t get ssh access with

ssh 192.168.0.xxx -p22222

(something about public key wrong or keyboard input which is obviously not possible with a VM?)

Next I tried “ssh-keygen” and am getting the same results.

Tried starting from scratch but now am getting this and not sure how to delete existing keys…

image

image

Can you provide some guidance on the best way to get this working ?
just can’t find a complete process for my use case.

Thank you.

You don’t need root access to the operating system to do that.

Edit: moved conversation here / opened pull request.

Thank you for your reply, but can you elaborate?
fyi, this is what I am referring to:

I think I managed to login to root and gain access to the container via
the VirtualBox CLI (it does accepts my login and docker commands)

image

Thank you!

Hi,
I need help to configure the access.
I’m using a Raspberry.
I installed the plugin.
I generated both public in private keys.
I copied the public key into the plugin configuration field using quotation mark “key”.
I tried to connect using Putty and it doesn’t work.
I tried to connect from the Home Assistant shell and it doesn’t work as well (I connected to Home Assistant via ssh on port 22 and I ran ssh ipaddress -p 22222).

This is 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
[skip] /dev/vda1 does not exist.
[skip] /dev/sda1 does not exist.
[skip] /dev/sdb1 does not exist.
Writing authorized_keys in /dev/mmcblk0p1
[SUCCESS] Key written to /dev/mmcblk0p1.
[skip] /dev/mmcblk1p1 does not exist.
[skip] /dev/nvme0n1p1 does not exist.
[skip] /dev/xvda8 does not exist.
[Done] Configurator complete. Perform a hard power-off now. This configurator only works once and is no longer needed.

From the shell the error is
root@ipaddress: Permission denied (publickey).

What could be the problem?

1 Like

Use ssh -vv to get verbose output.

Thanks, worked for me. Just have a question as a “green” person in topic. After uninstalling, public key is still there? If i lost private key and install this plugin again, perform all steps will work for new keys?

@adamoutler how can i use this to paste a audio file to my asterisk addon container? I can see the container folder but i dont know how i can paste a file inside the folder. :sob:

This has nothing to do with a ui (which is required for a ‘paste’.)

What exactly are you trying to do?

You’ll need to download things.

while this is great, the instuctions are wrong. create the key with putty keygen, I believe nothing else works.

when you copy the public key to the addon, don’t type SSH and do NOT use any quotes “”. Just copy the plain key from putty without line breaks or anything and then it works! took me 3 days.

The GUI must look like this:

Only then the YAML will look like this

It seems such a simple task but I fail on that whatever I do.

I noticed that the addon writes to sda1.
How can I confirm it’s correct?

df points to /dev/sda8. Could it be the reason why it doesn’t work? If so, how to workaround that?

Seems likely

partitions=(
  vda1
  sda1
  sdb1
  mmcblk0p1
  mmcblk1p1
  nvme0n1p1
  xvda8
)

How did you install HAOS?

I did it burning an official image into SSD.
I have the SSD connected to the USB3 port booting from it.

In the meantime, I spotted in Glances, that sda and sda8 are the same devices. But I suppose it doesn’t change anything.

sda is a drive. sda8 is a partition on that drive. They are not the same.

Why an app for doing something documented in the doc ? You just need a usb key.

  1. USB key was not always available
  2. USB key requires additional hardware
  3. USB key doesn’t always work