How to convert PuttyGen SSH-2 key-pairs to standard OpenSSH format

Today I generated SSH-2 RSA key pairs using PuttyGen under Windows. It is a handy utility for creating RSA/DSA public/private keys for authentication. These key files can’t be used in Linux directly. I will try to explain how to convert Putty’s private key (.ppk) to Linux OpenSSH format.

  1. Open PuttyGen
  2. Click Load
  3. Load your private key (.ppk)
  4. Go to Conversions->Export OpenSSH and export your private key
  5. Copy your private key to ~/.ssh/id_rsa
  6. Next step is to convert your public key from SSH2 format to OpenSSH using:
    ssh-keygen -i -f ~/rsa_ssh2.pub > ~/.ssh/id_rsa.pub

And of course you need to set the right permission to your private key file (chmod 600). Now you should be able to log into an SSH server using your private key. To install your public key simply copy from ~/.ssh/id_rsa.pub on your local machine to ~/.ssh/authorized_keys on the remote server.