Quantcast
Channel: Webkul Blog
Viewing all articles
Browse latest Browse all 5490

Converting a ppk file to a pem file for accessing AWS ec2 instances on Linux

$
0
0

Yesterday , i am working on the project in which i need to access the server which is a AWS EC2 instance. Putty ppk file has been provided to me to connect it, but i need to access it on linux so i need to convert this ppk file into equivalent pem file. I tried many things, google it, but nothing is working. Although i was able to connect via Filezilla but from terminal i can`t. Finally, by Hit-n-Try method, i got the solution.:D
Here is a list of steps I followed to convert that PPK file into an equivalent PEM file that I could use access Ec2 instance on linux terminal via SSH -

  • Install the putty tools, if you don`t have on Linux: as-
sudo apt-get install putty-tools
  • Generate the pem file run the following command: as-
puttygen ppkkey.ppk -O private-openssh -o pemkey.pem
  • Place the pemkey.pem file in your ~/.ssh directory: as-
cp pemkey.pem ~/.ssh
  • Set the pem file to have the proper permissions: as-
chmod 400 pemkey.pem

That’s it :)
Now, we have a valid pem file that we can use to connect to our EC2 instances from Linux. Below is an example:

ssh -i pemkey.pem user@ec2-instancedotcom

Similarly, if we want to convert pem file to ppk , we can do it like this -

puttygen pemKey.pem -o ppkKey.ppk -O private

#Flags:
-o Tells it where to write out the converted putty private key
-O private Tells it that you want a putty private key.

That`s it !!!
I hope it will help someone in the future. :D
And by someone I most likely mean by me ! ;)

Your opinions, comments and suggestions are important to keep the page updated and interesting. 

Viewing all articles
Browse latest Browse all 5490

Trending Articles