Puttygen generate pem
Converting a putty ppk file to a pem file for accessing AWS ec2 instances
A few weeks ago I was working on a project in which the existing developers had setup access to their AWS EC2 instances using putty as their ssh client due to them running on Windows 7. They provided the putty private key file they setup but that didn’t do me any good because I was running OS X. Here is a list of steps I took to convert that PPK file to a PEM file that I could use to SSH into any EC2 instance.
- To start you will need either macports or homebrew.
- if using macports you will run the following command to install putty for mac:
- if you are using homebrew you will run the following command to install putty:
- The remaining commands will be the same when using macports or homebrew. To generate the pem file run the following command:
puttygen privatekey.ppk -O private-openssh -o privatekey.pemputtygen privatekey.ppk -O private-openssh -o privatekey.pem
Keep in mind that you will want to substitute the name of your ppk file in place of the privatekey.ppk name I used. You will also want to change the name of the pem file you want to create rather than using privatekey.pem, unless of course you want to use privatekey.pem. - Next you should place the privatekey.pem file in your ~/.ssh directory
- Now, lets set the pem file to have the proper permissions:
chmod go-rw privatekey.pemchmod go-rw privatekey.pem