How do I install an SSH private key generated by PuTTYgen?

By coincidence, I just had to do this. You do need to convert the keys to OpenSSH format. The command for doing that is:

ssh-keygen -i -f puttygen_key > openssh_key

then you can copy the contents of openssh_key in to .ssh/authorized_keys just as with a normal SSH key.

The -i option is the one that tells ssh-keygen to do the conversion. The -f option tells it where to find the key to convert.

This works for unencrypted keys. The public key is unencrypted, but the private one is probably encrypted. I'm not sure if it there's a way to unencrypt the private key, convert it, and then recrypt it. It may well be easier to use new keys as the other answer suggests (and I'd recommend using ssh-agent though that's orthogonal to the current issue).


Andrew Stacey explained how to convert the keys to OpenSSH format on Linux.

If you want to do the same on Windows, follow these steps:

  1. Start PuTTYGen.
  2. Click on "Load".
  3. Select your private key and enter the passphrase.
  4. From the 'Conversions' menu, select "Export OpenSSH key".
  5. Choose destination filename.

I am not sure if your private key will work in ubuntu, but its worth a shot. just copy the keys to /home/yourName/.ssh/ name the private key as id_rsa, and the public key as id_rsa.pub.

If that is not working, then you can create you own ssh key-pair using ssh-keygen and copy the new public key to the server, and ssh as follows

ssh -i ~/.ssh/id_rsa_ubuntu.pub <hostName>

I haven't played with it, but I hear that ssh-agent can also be used to manage ssh-keys.