SSH Server Key Refused - PuTTY and OpenSSH

Is there anything special that is needed to get the version of the add-on mentioned by @cogneato?

I’m working with a fresh install of Hass (downloaded last week), have just installed this add-on, and after copying and pasting my public key (in its entirety) I receive the same error window that @EricR posted a screenshot of.

1 Like

Still doesn’t work.

I face the same issue, i fixed adding the key generated with putty to pageant, now its working ok

I had the same issue, if your trying to SSH to port 22, try SSH to the port under configuration -> network -> host port. I’m using 2222, when I ssh to 2222 it works without issue and accepts the private key.

This solved it for me. Thanks

New HA user here. I’m getting exactly the same problem with Home Assistant (Yellow) 2023.8.2 and Terminal & SSH version: 9.7.1.

Created keys in PuttyGen, pasted public key into Configuration Authorized Keys.
Loaded private key file into Putty Configuration / SSH / Auth / Private Key File

When connecting, the session gives the “login as:” prompt and I enter my HA user name.
Then “Server refused our key”.

I’ve tried port 22 and port 2222 with the same result.

HA log says

userauth_pubkey: signature algorithm ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Received disconnect from 192.168.1.106 port 41296:14: No supported authentication methods available [preauth]

An earlier post refers to an “official video” for SSH, but it is no longer available on the github site:

I also tried the fix suggested in this post:

For example, the following stanza in ~/.ssh/config will enable
RSA/SHA1 for host and user authentication for a single destination host:

Host old-host
    HostkeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa

(substituting the IP address of the host running Putty for “old-host”)
That did not change the result.

Edit - I reset the SSH server Options to default and did not enter a key, only a password. I am still unable to log in.
After entering my user name and the correct password, I get “Access denied”

don’t choose an RSA key. Go for a more secure one

Thanks for the feedback. So you’re saying HA doesn’t support the default key from PuttyGen?
Where do I find list of supported key types?
These are the key types offered:


Where could I learn more about the pros and cons of these choices and how to choose them wisely?
I found this but it was not clear. Is the key choice kind of like the choice of a Linux distribution? Strong opinions, but no clear choice?

use the SSH-2 ECDSA one. Select it at the bottom - The middle Button

I generated new keys in PuttyGen, selecting ECDSA.
In HA, Terminal & SSH, Configuration, Options, Authorized Keys, I pasted in the Public Key copied from the field “Public key for pasting into OpenSSH authorized keys file”
I saved the private key file.

In Putty, I opened the session for HA, and edit Connection, SSH, Auth. In the field “Private key for Authentication” I browsed and selected the private key file I saved from PuttyGen.

When I start the Putty session, it asks for login as: and I enter “root”.
Then it responds “Server refused our key”.

I can enable Password on HA, and it will accept login that way.

What else is needed to use SSH login?

Hi, your steps should work with Putty 0.81 and Terminal and SSH Add-on version 9.14.0. I only used key EdDSA instead of ECDSA but it should work will all types.
See:

Open puttygen, generate “ecdsa” key, save both public and private.

puttygen

edit with notepad the public key.

you get one similar to this:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: “ecdsa-key-20241025”
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLFCMaFkvP6I
cQUQZlQQM+G75OhZLrxaXAteorJdTzjQGu1PKs4d7HEZi4HglajQOqIaUz0jk45u
brb7yHWKTnY=
---- END SSH2 PUBLIC KEY ----

modify it this way, first copy the key without spaces…
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLFCMaFkvP6IcQUQZlQQM+G75OhZLrxaXAteorJdTzjQGu1PKs4d7HEZi4HglajQOqIaUz0jk45ubrb7yHWKTnY=

now we add at the beginning before the key and with out quotes followed by a space “ecdsa-sha2-nistp256”
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLFCMaFkvP6IcQUQZlQQM+G75OhZLrxaXAteorJdTzjQGu1PKs4d7HEZi4HglajQOqIaUz0jk45ubrb7yHWKTnY=

now we add a space at the end of the key followed by what we get in quotes in comment:
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLFCMaFkvP6IcQUQZlQQM+G75OhZLrxaXAteorJdTzjQGu1PKs4d7HEZi4HglajQOqIaUz0jk45ubrb7yHWKTnY= ecdsa-key-20241025

we have it! simply copy and paste it in “Authorized Keys” save and start Terminal & SSH

Now it should let you connect from putty or winscp without any problems.

1 Like