Tuesday, December 29, 2009

Using PuTTY ssh keys with OpenSSH on Ubuntu

Anyone who needs to access a unix/linux/osx machine from windows via ssh will be familiar with PuTTY, the free ssh client. PuTTYGen, available to download here, is a handy utility for creating RSA/DSA public/private keys for authentication. If you have generated your RSA keys using PuTTYGen, and would like to use them with OpenSSH on Ubuntu, you just need to follow a few simple steps:

  • Install putty with: sudo apt-get install putty
  • Create the public key file:
    puttygen /path/to/puttykey.ppk -L > ~/.ssh/id_rsa.pub
  • Create the private key file:
    puttygen /path/to/puttykey.ppk -O private-openssh -o ~/.ssh/id_rsa

You should now 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.