How to convert Linux OpenSSH key to Putty format on CREODIAS

In this article you will learn how to convert Linux OpenSSH key to format used by PuTTY. An example use case is if your coworker uses Windows and PuTTY and you use Ubuntu and you want to send them your private SSH key in the format which is ready to use with their software.

What We Are Going To Cover

Prerequisites

No. 1 Linux computer

You need a computer with Linux. This article was written for Ubuntu 22.04.

No. 2 SSH private key

You need to have your SSH private key. If you do not have one and want to create a key pair, see the following article: Generating an SSH keypair in Linux on CREODIAS

Install putty-tools

If you do not have the putty-tools package installed, you can do it by executing the following command in the terminal:

sudo apt update && sudo apt install -y putty-tools

Convert the key pair

To convert your OpenSSH private key to the format used by PuTTY, open the terminal. After that, navigate to the folder containing your SSH private key. Often, it will be ~/.ssh

If that is the case for you, execute the following command:

cd ~/.ssh

If not, replace ~/.ssh in the above command with the appropriate path.

From inside that folder, execute the command below. If the file which is your private SSH key is not named id_rsa, replace this value with the correct name.

puttygen ./id_rsa -o id_rsa.ppk

A file called id_rsa.ppk containing your private key should appear. You can verify its existence by executing the following command:

file id_rsa.ppk

The output should start with id_rsa.ppk: PuTTY Private Key File or something similar.

That file should be ready to use for PuTTY on Windows.

Warning

An unencrypted private key file like the one we generated here should typically be stored in a secure environment and transferred only using secure means of communication as it can provide access to important pieces of infrastructure.