Home Assistant Blue start/stop / connect putty

Thanks for the replies. I regards HA-blue as a bundle, HW & SW installed. As stated elsewhere, I only managed SSH through the terminal (add-on) within HA. That one stops when I stop HA (or likely more precisely, when stopping HA core also stops the UI)

I failed so far connecting SSH through PUTTY from elsewhere, connection steadfastly refused.
image
Samba works fine though, so its not a generic network issue. I suspect a setting in HA-blue that’s preventing external SSH, hence my expectation that the seller of a bundle provides minimum guidance or at least some contact.

Is port 22 open on the Blue? (Or whatever port you set in the ssh addon)

Putty works fine with the ssh addon. You have not shown how the addon is configured…

not much configuration in SSH other than the public key (with and without the comment around it)
and putty neither (other than the private key file in SSH)
keys generated with puttygen
image

That’s not the addon configuration. Have you installed ssh access to home assistant? It does not come pre installed.

Go to Settings → System → Hardware. Click the 3 dot menu in the top right. Select Restart Host. Very gentle.

Or if you prefer the CLI - ha host reboot.

Or are you actually trying to stop core? In that case you have several options:

  1. Settings → System and click restart in the top right
  2. Type c from anywhere and then type “restart”. Select the “Restart server” option
  3. Or again if you prefer the cli - ha core restart. Or ha core stop and then ha core start.

Neither of those are basic things. The SSH addons are only available to advanced users. Advanced users are kind of expected to know what they’re doing.

Why do you need SSH access anyway? Sounds like you already have Samba installed and so can edit your config. Restarting HA and rebooting the host are both options in the UI, there’s no reason you have to use the CLI for those.

2 Likes

He doesn’t want to restart core, he wants to stop core, play with his database, then start core. So none of the restart options are suitable. And once core is stopped you can’t use ui. His query boils down to whether the ssh addon continues to run when core is stopped. My experience is that the ssh and web terminal does continue to run when core is stopped.

That’s correct, on supervised all containers run irrespective of the state core is in. That being said, unless your OS runs into trouble.

SSH and Samba add ons have saved me on more than one occasion.

That is not the addon configuration. The addon configures the ssh server.

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.