Convert OpenSSH keys to PuTTY and PuTTY to OpenSSH keys

How to convert OpenSSH keys to PuTTY (PPK) and PuTTY to OpenSSH keys.

PPK (Putty Private Key) files are private key files used by Putty which is an SSH client that is mostly used in Windows.

This guide will show you how to convert private key files from Putty’s format to OpenSSH, and vice versa.

Prerequisites

Make sure you have the puttygen package installed.

1
2
sudo apt-get update
sudo apt-get install putty

Convert OpenSSH Key to PPK Format

This assumes that you already have a private key file in OpenSSH format. If you don’t then you can generate one by following the instructions in the OpenSSH Key Generation guide.

To convert your id_rsa file to private.ppk:

1
2
# convert private.ppk to id_rsa
puttygen id_rsa -O private -o private.ppk

Convert ppk to id_rsa

This assumes that you already have a private key file in PPK format. Follow the instructions in the PuTTY Key Generation guide to create one if you don’t have one already.

To convert private.ppk file to id_rsa:

1
2
# convert private.ppk to id_rsa
puttygen private.ppk -O private-openssh -o id_rsa