« Back to blog

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.

| Viewed
times | Favorited 0 times
Filed under:    

5 Comments

Feb 01, 2009
GR said...
First, you don't have to install all of putty if you don't plan on using the GUI. The puttygen tool is available via the putty-tools package. Second, thanks for the tip. Saved me the trouble of recreating a several keys and deploying the pub keys...
May 03, 2009
Leticia said...
The command "puttygen /path/to/puttykey.ppk -L > ~/.ssh/id_rsa.pub" doesn't work for me (Ubuntu Jaunty). I get the error "puttygen: unable to load file `/path/to/puttykey.ppk': not a private key"

Nevertheless, executing "puttygen /path/to/puttykey.ppk -O private-openssh -o ~/.ssh/id_rsa" it ask me for a "Enter passphrase to load key:" and generate the corresponding public key.

Thanks for this tip. You save me many hours.

Nov 30, 2009
Complete Linux PHP MySQL Nginx Reference - VPS Bible #20 - GUVNR said...
[...] Padraigkitterick.com .. example of Linux to VPS using PuTTY keys [...]
Nov 30, 2009
Set up a Remote Encrypted Connection - VPS Bible Pt 3 - GUVNR said...
[...] you're using a local Linux Ubuntu machine, I can't help with that as I've not tried, but this chap has, so hopefully that [...]
Jun 04, 2010
Amit Agarwal said...
PuTTY alternatives - AlternativeTo.net...

I found your entry interesting thus I've added a Trackback to it on my weblog :)...

Leave a comment...