'Cannot connect to Windows 10 over SSH running OpenSSH

I have a Windows 10 machine running OpenSSH that I need to connect to over SSH using PuTTY. I have created a public/private key on the Host machine using PuTTYgen. I loaded the public into the user's profile directory under .ssh/authorized_keys. When I connect with PuTTY from a machine outside the network I get this error message:

"Server refused our key"

I have read several posts and they all indicate the public key is not being read correctly. I have made the following changes with no success.

  1. Update user permissions on .ssh and /authorized_keys setting the User as the owner.
  2. Currently my .ssh folder is located in %SYSTEMDRIVE%/users/[USERNAME]/.ssh
  3. I recreated this directory on my data drive to be sure that was not an issue: "D:/users/[USERNAME]/.ssh
  4. Because the account I am using is an administrator account I have created "%Program Data/ssh/adminstrators_authorized_keys
  5. I commented out the line in sshd_config that looks at the file in #4 when the user is an administrator.

None of these attempts have cleared up the problem. I have never set up SSH on a Windows 10 host before so I am out of ideas. I set up logging in sshd_config but there are no log files being generated.

Can someone help me get this figured out?



Solution 1:[1]

In my case, the message in sshd -d was

Failed publickey for [user] from [IP] port [port] ssh2: RSA SHA256:[fingerprint]

The cause was that the authorized_keys file was in UTF-16 format. It needs to be UTF-8 to work.

Solution 2:[2]

Make sure that your user in Windows10 is active. By default for instance the user Administrator is not active, and should be enabled with:

net user Administrator /active:yes

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fenhl
Solution 2 Skeptic