Home Assistant Blue start/stop / connect putty

Thanks @nickrout , you summarized it perfectly.
Samba keeps running when I stop HA and I’m confident so does SSH. But I still have not managed accessing SSH from my windows-putty and (re-)start HA core after a while of downtime other than cycle the power.

my SSH/Terminal add-on configuration

authorized_keys:
  - >-
    AAAAB3NzaC1yc2EA........6a50WohUjIl
  - >-
    ---- BEGIN SSH2 PUBLIC KEY ---- Comment: "rsa-key-20220622"
    AAAAB3NzaC1yc......26a50WohUjIl ---- END SSH2 PUBLIC
    KEY ----
password: ''
apks: []
server:
  tcp_forwarding: false

OK. Thankyou. Does the log for the addon tell you the RSA key has not been accepted? It did for me and I had to switch to using a ed25519 key (you can create in PuttyGen) I am using it in a secret in this format:
ssh_web_addon: ssh-ed25519 AAAAC…cJdmdCr ed25519-key
It won’t work with the rsa key unless a recent update restored that…
I did write about this recently in the thread here for the addon. See this post and the discussions prior to it in this thread Home Assistant Community Add-on: SSH & Web Terminal - #457 by DavidFW1960

also this is my addon configuration

allow_agent_forwarding: false
allow_remote_port_forwarding: false
allow_tcp_forwarding: false
authorized_keys:
  - '!secret ssh_web_addon'
compatibility_mode: true
password: ''
sftp: true
username: root

A couple of quick comments:

  • I noticed that the “Terminal & SSH” and the “SSH & Web Terminal” are (similar but) different add-ons.
  • Maybe we (temporarily) remove the variable of auth key: Use the username + password challenge instead, and remove the auth key, at least to test that SSH itself being functional.
  • What does the log of the add-on say, when you try to connect from putty?
  • Is port 22 open on 192.168.0.2? nickrout has asked the same but I have not seen the answer.
  • The document of the “Terminal & SSH” specifically says, when you connect, “you end up in this add-on’s container”. So what exactly are you planning to do via SSH? Do you have a way to jump from the prompt of the container to the prompt of the HAOS??

And a couple of questions:

What do you mean by “stop HA”? How exactly did you “stop” your HA?

Where is this “elsewhere”? A different room in your house, different subnet, or outside of your home?

== EDIT: Mod has moved/split this thread to its independent thread, so not applicable any more ==
This thread is about metal boxes to run HA. But then since your “HA works fine and I got quite a few custom integrations working” and “Samba works fine”, it does feel more like a SW / config issue now.
Do we consider we split the thread?

Probably best to add the ssh discussion to @brun059 's thread on the same issue.

Thanks for asking the right questions. Looks like port 22 is closed on the HA-Blue bundle

C:\Users\bruno>curl -v telnet://192.168.0.2:22
*   Trying 192.168.0.2:22...
* connect to 192.168.0.2 port 22 failed: Connection refused
* Failed to connect to 192.168.0.2 port 22 after 2055 ms: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.0.2 port 22 after 2055 ms: Connection refused

Log also says SSH port is disabled.

[cont-init.d] executing container initialization scripts...
[cont-init.d] apks.sh: executing... 
[cont-init.d] apks.sh: exited 0.
[cont-init.d] keygen.sh: executing... 
[13:21:06] INFO: Restoring host keys...
[cont-init.d] keygen.sh: exited 0.
[cont-init.d] profile.sh: executing... 
[cont-init.d] profile.sh: exited 0.
[cont-init.d] ssh.sh: executing... 
[13:21:06] INFO: Setup authorized_keys
[cont-init.d] ssh.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[13:21:06] INFO: Starting Web Terminal...
[2022/06/22 13:21:06:9020] N: ttyd 1.6.3-3e37e33 (libwebsockets 4.2.1-v4.2.1)
[2022/06/22 13:21:06:9021] N: tty configuration:
[2022/06/22 13:21:06:9021] N:   start command: tmux -u new -A -s homeassistant bash -l
[2022/06/22 13:21:06:9021] N:   close signal: SIGHUP (1)
[2022/06/22 13:21:06:9021] N:   terminal type: xterm-256color
[2022/06/22 13:21:06:9021] N: LWS: 4.2.1-v4.2.1, loglevel 7
[2022/06/22 13:21:06:9021] N: NET CLI SRV H1 H2 WS ConMon IPV6-off
[2022/06/22 13:21:06:9032] N:    /usr/lib/libwebsockets-evlib_uv.so
[2022/06/22 13:21:06:9093] N:  Using foreign event loop...
[2022/06/22 13:21:06:9093] N:  ++ [wsi|0|pipe] (1)
[2022/06/22 13:21:06:9094] N:  ++ [vh|0|netlink] (1)
[2022/06/22 13:21:06:9095] N:  ++ [vh|1|default||8099] (2)
[2022/06/22 13:21:06:9096] N: lws_socket_bind: nowsi: source ads 0.0.0.0
[2022/06/22 13:21:06:9096] N:  ++ [wsi|1|listen|default||8099] (2)
[2022/06/22 13:21:06:9096] N:  Listening on port: 8099
[13:21:07] WARNING: SSH port is disabled. Prevent start of SSH server.

Trying to use nc to open 22 failed, or at least I failed. .

Version	core-2022.6.7
Installation Type	Home Assistant OS
:
Operating System Version	5.15.45

Attempting to answer the other Qs

ha core stop in the terminal-addon (which then is the famous last command for “this terminal”)

windows PC, the same I connect to HA-Samba (same subnet etc.)

… you enabled the port by putting in 22 on the tcp section right?

Yeah does putty work when core is running?

Yes. All addons require you to type the port you want to give “External” access to. So if he leaves the port blank, it’s disabled. I put external in quotes because external does not mean “expose to the internet” it means “enable the port for your network to access it”.

Bruno - Reference your comment on 6/23, the port should be specified under the same config page, and further down - at least if you want to connect to port 22 of your 192.168.0.2.

putty of course tries connecting to port 22.

I tried both in the config of the SSH add-on, explicitly listing 22 and show disabled ports as well as the defaults. If you mean something else with “putting in 22 on the tcp section” then I’m clueless.

That screenshot shows it empty though.

Keep in mind, you have to restart the addon after making that change.

:grinning: :+1:, the 22 to the right fooled me. I thought that’s the active setting and left it as it is…
Never got the idea that I have to set / retype it explicitly. and was tinkering with show disabled ports on/off - only

Now it refuses the key but I guess the solution to this is from

Nope, that’s why you had to click ‘show disabled ports’. Cause it was disabled

So the problem wasn’t really that stopping core stopped ssh access, it was that ssh access wasn’t even enabled.

Sheeesh.

I can see how that would be confusing. I think I would have thought it was the default too.

Especially since the words say “Change the ports…” not “Add the ports”

But he has to click the button “show disabled ports” to even see that… that means it was disabled

If he’d explained the problem properly, given logs and config we could have got to the solution. Wooly and misleading questions generate wooly and misleading answers.

@petro could you please move all this OT stuff to @brun059 's thread here. Home Assistant Blue start/stop / connect putty

both, stopping core stopped the Terminal web-UI embedded in HA - and using alternative was blocked by me fooled by the 22/tcp not being the same as 22 enabled :wink:

The fact remains that you were never able to use putty, whether or not core was running. Failing to mention that led to a long thread about nothing.

1 Like