I'm trying to connect to Windows through SSH with public key authentication. But apparently not working.

Here are what I have done.

I installed and activated the SSH on the windows.

Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~

I generated public key files and sent to the remote machine to ssh from.


I changed/added following lines in the SSH setting file "C:\ProgramData\ssh\sshd_config"

PermitRootLogin yes
AllowUsers otheruser
PubkeyAuthentication yes
PasswordAuthentication no

I restarted the ssh server to apply the setting changes.

net stop sshd ; net start sshd

I tried to ssh from the remote machine (also windows, powershell) to the windows machine

ssh -i C:\_sync_\id_rsa tmp@

and failed.

> ssh -i C:\_sync_\id_rsa tmp@
tmp@ Permission denied (publickey,keyboard-interactive).

So, how can I solve this SSH public key authentication issue?

  • 1
    Does this answer your question? Windows SSH server refuses key based authentication from client
    – Daniel B
    Apr 22, 2021 at 11:42
  • What is "authorized_keys"? I didn't find any mentions about it in the SSH pubkey authentication tutorial I saw. Is it necessary? Apr 22, 2021 at 12:17
  • Yes, absolutely. It is quite unlikely a tutorial on SSH public key authentication would not mention this. Please provide a link to the tutorial.
    – Daniel B
    Apr 22, 2021 at 13:08

1 Answer 1


SSHing to Windows is kind of waste of time. Their document https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement is outdated https://github.com/MicrosoftDocs/windowsserverdocs/issues/4598 and no longer works, unfortunately.

If you're on Windows 10, I suggest using WSL Linux on your Windows 10. It's basically Linux machine on Windows, but also available for the SSH feature. The WSL SSHing does work perfectly as well as you can do on a Linux machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.