SSH Key Authentication Problem (and Solution)

I set up the SSH Server add-on and tried to get SSH running from MobaXTerm with public/private key authentication. I pasted the key from Putty Key Generator into the config box under the SSH Server configuration page. I loaded the public key file into the MobaXTerm session. But MobaXTerm SSH kept saying the login was refused and I kept getting this error in the SSH Server log:

Disconnected from authenticating user root 172.30.32.1 port 41632 [preauth]
Received disconnect from 172.30.32.1 port 41636:14: No supported authentication methods available [preauth]

I tried all kinds of things I found on the web.

  1. I found out that the private key file had Windows EOL characters and I converted them to Unix.
  2. I tried different formats of the public key string I pasted into Home Assistant SSH Server configuration page. Ultimately I returned to just copying it from the Putty Keygen and pasting it in (with enclosing quotes).
  3. I tried different formats of the private key file (like deleting the public key info from it) – just a WAG and it had no effect.

Finally, I found a post on the Ubuntu community about sshd problems. The following fixed it in HA.

Went into the Terminal Window on Home Assistant.
cd /etc/ssh
vi sshd_config
(added the following lines:)

PubkeyAuthentication yes
RSAAuthentication yes

One (or both) of those are what did it.

FYI.

What fixed it for me was modifying both keys to LF only.

Hello,

please what do you call "LF"?

Also I have tried to solution you proposed, but it seems that when I restart the SSH add-on in HA, the lines added in the sshd configuration files disappear.
Do I missed something?

Thank you
Thierry