Ssh: connect to host hassio.local port 22: Connection refused

Hello, I’m trying to connect to my raspi3 using ssh from terminal in Mac OS. I have SSH and Samba installed, but when I put in the command:

ssh [email protected]

I get the error

ssh: connect to host hassio.local port 22: Connection refused

I’ve tried searching but can’t seem to find a clear solution. Help!

Thank you.

Do you have the SSH addon turned on?

Did you set up your keys?

I just had a similar issue. Are you using the SSH add-on or trying to get in at the docker level? For the SSH add-on I specified a different username (which I had forgotten, and using the right one fixed my issue), and with both I have to specify the port with -p 22222 for docker, and -p 22 for the SSH add-on.

well, I think so. The ‘start on reboot’ option is turned on, and even if I manually click ‘start’, I still get the error.

I did not set up keys, because I thought it wasn’t required.

Honestly I don’t know what most of that means. I’m not too familiar with all of this. Mostly just figure things out as I go. What’s the docker?

I don’t know how to set up a username.

You must use keys. The instructions even tell you that.

No worries. You posted under the “hass.io” category, so I assume you’re using the Hass.io install for Home Assistant? If so…

How did you “install” SSH as you described? If you are using this Add-On:

Then you need to configure it in order to use it:

You do this configuration on your Home Assistant web interface by going to Hass.io and selecting SSH - Secure Shell and updating the Config window as described.

In that Config window, one of the things you specify is the username, which I called out because you posted that you tried to SSH in to [email protected], which won’t work, unless the username you specified is root. I had forgotten mine, so I had to check what I had used, then it worked for me (I don’t SSH often). There are other things to configure, so I’m assuming you’ve done all that, or it won’t work.

Regarding “docker”, the Hass.io installation is a prepackaged operating system that runs virtual environments called dockers. Each docker is independent of the OS and other dockers (they’re not directly aware of each other). If you SSH in to the OS (using an SSH shell at the OS level) you won’t be interacting with the Hass.io docker unless you know where to find the files for it. The Add-on I mentioned above runs within the Hass.io docker, so if you use that SSH shell you’re in the docker and directly interacting with Hass.io. To differentiate the SSH you are connecting to, you use a port when configuring SSH, and specify that port when connecting. The default port on the Add-on is 22. The default port for the OS in Hass.io is 22222.

So, to SSH in to the Add-on I use: ssh {username}@hassio.local -p 22. To SSH in to the Hass.io OS-level I use: ssh [email protected] -p 22222. For now, I’d recommend you stick with the Add-on.

Hope this helps.

2 Likes

Ah… so @flamingm0e and I posted about the same time, and he references yet another SSH option. So, first, you need to specify which one you’re trying to use. That one does use “root” as the username, so if that’s what you’re using ignore the config for the one I mentioned.

Or uninstall that one, and install the one I linked to.

Its a case of so many options they can be confusing.

Hassio is limited. To get to the host OS, you have to use port 22222. If you have the SSH add-on then you connect to a container that ties into the home assistant container. There aren’t really multiple ways of access, one is the host and one is ‘inside’ the container

The SSH Server option you pointed to is installed and configured differently than the one I pointed to (SSH Server is in the “Official add-ons” area, I’m pointing to SSH - Secure Shell which is in the “Community Hass.io Add-ons”), and both of these are different than the SSH shell of the host OS, and both of these add-ons get you inside the Hass.io docker container as you said.

Looking back I’m guessing @Ted_Gore is using SSH Server from the Official Add-ons which does not allow configuring a username, so my post may not be relevant. Still need clarity on which he “installed”.

Thanks for all the replies. This is the server I am using…

I tried setting up keys but when I try to paste in the key into the SSH window in hass.io it’s all red and won’t let me save.

Pretty frustrating how difficult this is. All I need is to get the usb hub so I can install z-wave. I really don’t have any other need for SSH access.

Ok I tried changing over to the SSH - Secure Shell add-on. I tried following the instructions as best as possible for generating the key, but when I do the login command in terminal I get the error,

‘Unable to negotiate a key exchange method’

this is what my config looks like:

Why do you need SSH to get zwave?

All looks good. Only difference with mine is I didn’t put a password since its using an rsa key.

I was going to ask what it was you were trying to accomplish… what is it you need from the usb hub (and to clarify, by hub you mean you plugged a hub in to your Pi, or just one of the ports on the back of your Pi)?

My zwave config in configuration.yaml is:

zwave:
  usb_path: /dev/ttyACM0
  polling_interval: 30000

because I need the usb path for the component install. Is there another way?

Yeah I just need the usb path for whatever usb port the zwave antenna is using on the rasberry pi. The directions I’m following instruct to find the path via ssh. Is there anonther way?

I mean…have you tried it that way?

did you put your ssh key in quotes?

{
  "authorized_keys": [
"ssh-rsa ksAAB3NzaC1yc2EAAAADAQA2AAABAQCt3xyhtjh3fzpF5NXizDrsw9HsstsKPl+Zrn0LWXfhORczQuBXPcxEe5dW4Bz7AMnHReCbifg6tyKuKJfWgR6TF5MlE8TYViJKsHpgDfnEkM+e1C7zR3ToydZ4NZT3c1Nlkcya3EOuM7G8n0JltSo1hVd3hTgsyCwEXkX22/Ad0D/LZGXq3QdIwujOosM0ugknSXZTfOsuO68mY9Y2nS12T0N/7NZKaopuMBgic4wUPQ2HPQBjg3klkYhj8e6K1X2YxEoLzmKloHV7DYa34Xmxx8Q8sGzjWxc2hE8phLt/jyGNzeyOvEyb3X/EoDcfZzko7hgMrlGw6O0K7s+6Z64V [email protected]"

],
“password”: “”
}

Keys are not required for either add-on. You can use a password, but keys are more secure. One add-on only allows root as user, the other from the community repo allows for users other than root. When you ssh in, forget the host name and use the IP address instead. For the community repo ssh add-on there’s a web terminal which is convenient. They exist mainly to provide you with the custom CLI commands that hassio has, and are not meant for full system access because there isn’t really a full Linux os to access.

And you don’t need any of this to set up your zwave. But you should have one of them anyway.