Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save muse-sisay/24e6e18229e8e15b4df60513bcd407ed to your computer and use it in GitHub Desktop.
Save muse-sisay/24e6e18229e8e15b4df60513bcd407ed to your computer and use it in GitHub Desktop.
Adding private key to Windows Server 2016

Getting the following error when trying to SSH into your windows machine?

Permission denied (publickey,keyboard-interactive).

This is probably because PasswordAuthentication is set to no. It also maybe that you haven't added your public key to the server. To add your public key follow these steps

Step 1: Generate on SSH Key pair

Log onto your local machine and generate a ssh key pair. For this gist I will be using windows_server as the file name

$ cd ~/.ssh
$ ssh-keygen -f windows_server

Step 2: Copy Public Key

Copy the contents of windows_server.pub to C:\ProgramData\ssh\administrators_authorized_keys file in your windows server.

Step 3: Restart the sshd server.

Open Control Panel\All Control Panel Items\Administrative Tools > Services. Look for OpenSSH SSH Server on the list of services. Click on restart on the right hand side.

That's it friends. Hopefully this had solved your problem.

@goikelem
Copy link

Thanks dear bro solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment