PuTTY: ‘Unable to Use Key File’ Error

PowerADM.com / Windows / PuTTY: ‘Unable to Use Key File’ Error

When you connect to a remote SSH host from Windows using the PuTTY client, you may receive an error message about an incompatible private key format:

Unable to use key file (OpenSSH SSH-2 private key (old PEM format))
Or:
Unable to use key file (OpenSSH SSH-2 private key (new format))

PuTTY - Unable to use key file

The format of SSH keys generated by ssh-keygen is not supported by PuTTY.

You need to convert your SSH key to the PuTTY format to solve this problem. This is done using the PuTTYGen tool.

  1. Run the puttygen.exe;
  2. Select Conversions -> Import key and specify the file containing your private RSA key;
  3. Then click Save private key and save the key in .ppk format (if necessary, you can set a password to protect the key); convert private key with puttygen.exe
  4. Now run the PuTTY client and go to Connection -> SSH -> Auth. Select your PPK key file in the Private key file for authentication field. PuTTY: set private key file for authentication
  5. Try connecting to a remote SSH host and make sure the Unable to use key file error is gone.

In some cases, PuTTY may return another error when connecting to a host using an SSH key:

Couldn't load private key - Putty key format too new.

This usually means that you have generated a key for SSH protocol 3 and are trying to connect to a host using SSH 2. SSH-1, SSH-2, and SSH-3 key formats are different.

To fix the problem, try changing your preferred SSH version in the PuTTY settings.

Or you can use PuTTYGen to convert the format of the key:

  1. Import your key file and select Key -> Parameters for saving key files;
  2. Change the option in PPK file version -> 2 PuTTYGen change ppk file version
  3. Save your PPK file and try to connect to the host using SSH.
Leave a Reply

Your email address will not be published. Required fields are marked *