Accessing Terminal using SSH

Good day,

I have config “Advanced SSH & Web Terminal” as per some YouTube video’s.

Going to “Windows PowerSheel” at the cmd prompt, I enter:
PS C:\Users\user> ssh [email protected]

I have previously said yes to the lines followed

[email protected]’s password: entered my password
[\e]0;\u@\h:\w\a]\W $ ← this is what I get

What am I doing wrong? It is not showing the “Terminal” “front page”

If I am in HA and use “Terminal” it works fine, but not if I access it through Windows PowerShell, Putty or any of these types of programs.

My guess is an incorrect $TERM setting in PuTTY.

In the old days, terminals were hardware devices (CRT screen, keyboard, serial interface, later LAN) and worked differently - e.g. VT100 gave different characters than an xterm. Control characters like bold and colours were very likely to use different control codes. Software terminal emulators are the same - try VT100 or xterm or whatever and see if the \e\w\a disappears.

The thing is, it does the same with Windows Terminal. Most of the example I looked at, they used this and it worked fine when they show it in “YouTube”.

Like most things, it works fine in the example, but when I try it…

The $TERM will be wrong there as well - works fine on Linux with $TERM = xterm-256color which suggests the number of colours might be the issue.

There have been a few similar posts on this same issue suggesting something has changed recently.

FWIW, using Windows 11 built in ssh.exe to HAOS on port 22222 works fine and still correctly sets up the terminal. Maybe this is related to the Add-in. Technically, PowerShell is running the ssh.exe built in to Windows, just like cmd.exe would do.

You can add -vvv to the ssh command line and get debug output. You should see debug related to the terminal setup:

debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug3: This windows OS supports conpty
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug3: Successfully set console output code page from:65001 to 65001
debug3: Successfully set console input code page from:437 to 65001

What does your version say?

The default shell is zsh on the HA appliance. Given that – “Oh my zsh” is a godsend.

Scroll down and you’ll find the install, which is done from the shell on the HA appliance (your Raspberry Pi or equivalent):

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Once you do this, you’ll get a very nice prompt and many other goodies pertinent to the shell.

[EDIT]: The real crux of this issue is this:

https://github.com/hassio-addons/addon-ssh/issues/788

Furthermore, installing/configuring “Oh My Zsh” again works only until you reboot. Then all changes, for some reason, get wiped out. The simple fix from 788

ln -s /home/<username>/.profile /home/<username>/.zprofile

also does not survive a reboot. I don’t know why any additional files added to your home directory are removed at reboot. Everything is reset to stock when the system is shut down.

Because Home Assistant is a docker container. This is the nature of docker. Only the files under /configuration are retained.

Actually a bunch of docker containers; even the ssh add-on is itself a container. My question is how all of this is orchestrated at boot – how are these containers instantiated? There has to be a base OS the box boots into, correct?

Yes, dependent on the install method. Perhaps this will help. Are you familiar with the Community Guides? Always a good place to start a self-help journey of education.

SSH Development Access (Core SSH, Root CLI) - Community Guides - Home Assistant Community

Thanks! I also found this regarding s6_overlay which explains the orchestration part. Now on to the specifics of what HA does with it.