convert pem to ppk in linux

How to Convert PPK to PEM Using PuTTY in Linux

Secure Shell (SSH) is the most common way to developers to access remote Linux systems. But in this case you need the remote server’s private key file in order to access SSH. It is available in .ppk or .pem file formats. You need to upload this key file into your local SSH client in order to be able to access remote server securely. Sometimes you may have .ppk file available with you but your SSH client accepts only .pem keys. In this case, you will need to convert PPK to PEM using PuTTY in Linux. In this article, we will learn how to do this. We will use putty-gen for our purpose.


How to Convert PPK to PEM Using PuTTY in Linux

Here are the steps to convert PPK to PEM using PuTTY in Linux.


1. Install Putty Tools

Open terminal and run the following command to install PuTTY tools using the command below.

$ sudo apt-get install putty-tools 


2. Convert PPK to PEM

Next, run the following command to convert your ppk file (e.g. server.ppk) to pem file (e.g. server.pem).

$ puttygen server1.ppk -O private-openssh -o server1.pem 

On the other hand, if you ever need to convert PEM to PPK, run the following command.

$ puttygen server1.pem -o server1.ppk


3. Change pem permissions

Next, we set the permission of .pem file to be read only to owner and remove all permission to group and others. Else this key will be refused.

$ chmod 400 server1.pem 


4. Connect to Remote Host

Finally, run the following command to connect to remote host via your Linux terminal. Replace ubuntu with your username, and remote.host with the IP address or domain of Linux system.

$ ssh -i server1.pem ubuntu@remote.host 

In this article, we have learnt how to convert PPK to PEM and vice versa.

Also read:

Linux History with Timestamp and User
How to Disable Swap in Linux
How to Call C Function in Python
How to Change Default MySQL Data Directory
How to Run MySQL Query from Command Line

Leave a Reply

Your email address will not be published. Required fields are marked *