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.
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 PuTTYgen 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.
And by someone I most likely mean by me !
[stextbox id=”info”]Your opinions, comments and suggestions are important to keep the page updated and interesting. [/stextbox]
20 comments
Thank you so much for your appreciation. For any suggestions, you can also email us at [email protected] and we will get back to you accordingly.
Thank you