Need Help adding SSH key for host OS (not HASS SSH add-on)

Hi guys,

I have successfully created my SSH keys for the SSH add-on for and it works great as long as I don’t break HASS. :slight_smile:

But now I am having some typical noob issues, due to breaking HASS with a bad configs. (BTW, the built in configuration checker is returning ‘valid’ to configs that break HASS. But that’s another post for later.)

If I have a bad config, or worse still a ‘valid’ config (see above) that isn’t valid and I reboot HASS, I will lose SSH access. I get ssh: connect to host hassio.local port 22: No route to host when I try to connect again, presumably because HASS never comes back up.

In the situation outlined above, without SSH access to the host’s SSH server, the only recourse I have is to reboot the whole RPi3, which gives me SSH access to HASS again. Then I can check the/config/home-assistant.log and find out what the issue was, fix it and get it working again. But I’m breaking it constantly while I’m learning and tweaking so SSH access to the host is required.

I have been trying in vain to join together the various bits of information for creating SSH keys and I haven’t had any luck so far.

What I understand is, I need to put my public SSH key into a file called authorized_keys and put that file in the root of the SD card. What would be helpful is an example of what the contents of a valid authorized_keys file looks like and how I am supposed to get that file to the root of the SD card.

I am trying to use the same public key that I created when I setup the SSH add-on for the first time. I have just renamed that *.pub file to authorized_keys and copied it to the root of the SD card when I load the SD card in my MacBook. Mainly because I don’t know if any other way of getting files on the the SD card without SSH access. But I’m thinking this isn’t the root of the SD card that the docs are talking about? e.g. the list of the files in folders I can see when its loaded in my Mac is nothing like a Unix root folder structure.

SO, how pray tell, do I get this SSH key into the host OS so I can SSH into it if I can’t SSH into it? What am I doing wrong?

Thanks in advance?

1 Like

So with the help of @mihalski over at Gitter we figured out where i was going wrong.

The problem was I was copying the ‘’ file to my SD card and renaming it to authorized_keys using Finder on my Mac.

The problem was Finder was keeping the .pub file extension but it wasn’t displaying it like it did prior to renaming the file for some reason.

It wasn’t until @mihalski suggested that I do a 'ls -l /Volume/resin-boot/` to list the files on the SD card that I could see the .pub file extension!

After removing that, we were in business! =D

I fix the config_check addon to detect wrong yaml config too.

1 Like

Thanks @pvizeli! :slight_smile:

Thank you. I had put authorized_keys in resin-rootA, thinking it was the root.

I was having trouble logging in as root to the host as well. In my case, I created an SSH key with the more secure ed25519 curve (ssh-keygen -b 4096 -t ed25519). While the generated ssh key works fine to login into the container, it was rejected for the host. I generated another key pair without any fancy parameters and copied the public key to the boot (!!) partition with filename authorized_keys and it was working instantly.