PuTTY Server Refused Our Key | How to Troubleshoot (Step-by-step Guide)
Here is a possible error message when you try to connect to the remote SSH server using Putty SSH Key: "server refused our key".
This is because you haven't copied your public key to the remote server or haven't done it properly.
Your public key should exist in the authorized_keys file of the user account you used to login to the remote server. The solution is to copy the public key from your Windows 10 PC to the user's authorized_keys file.
Note that each user has their own authorized_keys file in the home directory. For example, If you log in as user root, you need to place the public key to the "/root/.ssh/authorized_keys".
To solve the "server refused our key" error, you can do the following steps:
Open PuTTYgen, Go to File > Load Private key and open your Private Key File.
Highlight the Public key that was created in the text box and copy it to the clipboard.
Next, Log in to the Linux server and change to the home directory with the cd command:
Then, create the .ssh folder and the .ssh/authorized_keys file (if it doesn't already exist):
mkdir ~/.ssh touch ~/.ssh/authorized_keys
Open the authorized_keys file and paste the public key.
When you are finished, save the file exit the session.
To connect to the remote server. Open the PuTTY terminal and provide the IP address of the remote server. Then, Go to Connection > SSH > Auth and Load the private key after clicking on the Browse button.
Click on Open to establish SSH connection to the Linux server. You should be able to connect to the server without getting "Server refused our key" error.