How to fix Server refused our key?

If you are experiencing the error “server refused our key” when trying to connect to a remote server using PuTTY on a Windows machine, there are a few potential causes and solutions you can try.

1. Generate a New Key

  • First, generate a new key with puttygen on your Windows system.
  • Then load that key in the putty profile, as you do normally.
  • enter the new public key in ~/.ssh/authorized_keys in just one line.
  • Now on the server enter chmod 700 ~/.ssh
  • Then enter – chmod 600 ~/.ssh/authorized_keys
  • Now enter chown $USER:$USER ~/.ssh -R
  • Now Change /etc/ssh/sshd_config so that it contains AuthorizedKeysFile %h/.ssh/authorized_keys
  • Now restart the ssh server service with sudo service ssh restart.

2. Using incorrect login credentials

Double-check your login credentials: Make sure you are using the correct username and password for the server.

3. Using the incorrect private key

Check your private key: If you are using a private key for authentication or is the correct authorized key, make sure you are using the correct private key file and that it is in the correct format.

You can convert your private key to the PPK format using PuTTYgen, which is included with the PuTTY installation.

4. The Server is not accepting connections from your IP address

Check the server’s IP address configuration: If the server has a firewall setup and is only accepting connections from specific IP addresses or ranges, make sure your IP address is included.

5. Change Server’s SSH configuration

The server’s SSH daemon may be configured to only allow certain types of authentication (e.g., password-based or key-based). Make sure the server is configured to accept the type of authentication you are using.

If you want to use public key authentication make sure that it is enabled in the config file.

6. Change Server’s Firewall rules

The server’s firewall may be blocking incoming connections to the SSH port. Check the firewall rules to ensure that connections to the SSH port are allowed.

Enable incoming connections from port 22 which is the ssh port or whichever custom port you might be used for login. Make sure to include the custom port in your sshd config too.

7. Incorrect PuTTY configuration

Make sure that you are specifying the correct hostname and port in the PuTTY configuration. Also, make sure that the correct authorized key file is being used in putty.

How to fix Server refused our key?
Article Name
How to fix Server refused our key?
In this article, we'll discuss the potential causes and offer a step-by-step guide to fix the server refused our key error.

Leave a Comment