How to Convert PPK File to OpenSSH Keys and Login using SSH in Linux?

Updated on September 2, 2017

Question: Thanks for the tutorial on “How to login to Linux instance using keys“. I used PPK key file via PuTTy to login to my Linux instance. Could you tell me how to convert PPK file into OpenSSH keys format, so that I can login to my instance using SSH command on Linux as below:

$ssh -i key centos@ip-address

Answer:

Since you have the .PPK file ready, let us convert that into a format that OpenSSH supports.

On CentOS:

Install PuTTY tools as below:

$yum install putty
::::::::::::::::::
Running Transaction
Installing : putty 1/1

Installed:
putty.x86_64 0:0.63-4.el5

Complete!

On Ubuntu:

Install PuTTy using apt-get as below:

# apt-get install putty
:::::::::::::::::::::
Setting up putty-tools (0.63-4ubuntu0.1) ...
Setting up putty (0.63-4ubuntu0.1) ...

convert ppk to ssh keys

Convert .PPK format to OpenSSH file format

Extract Public key and Private Key using PuTTy tools.

$ puttygen key.ppk -O private-openssh -o private.key
$ ls -l private.key
-rw------- 1 test test 1675 Dec 1 17:02 private.key
$ puttygen key.ppk -O public-openssh -o public.key
$ ls -l public.key
-rw-rw-r-- 1 test test 402 Dec 1 17:03 public.key

Set right permission for the keys as below:

$ chmod 600 private.key
$ chmod 644 public.key

Use OpenSSH key to login to your instance as below:

$ ssh -i private.key centos@ip-address.

That’s it.

Use PuTTY keygen on Windows to convert PPK to OpenSSH keys

Install PuTTY keygen and simply load the PPK file as shown in the below image. Once done, you can save the public and private key files.

convert ppk to ssh keys

Was this article helpful?

Related Articles

Leave a Comment