I have generated and downloaded a private .pem key from AWS. However, to use Putty in order to connect to the virtual machine, I must have that key in .ppk format. The process of conversion is detailed in roughly 20 lines here:

I am using Linux Mint (an Ubuntu distro) and I know I can use puttygen in the terminal. However, I have no idea how to use this tool, nor how to configure the needed parameters. When I type puttygen --help I get

PuTTYgen unidentified build, Aug  7 2013 12:24:58
Usage: puttygen ( keyfile | -t type [ -b bits ] )
                [ -C comment ] [ -P ] [ -q ]
                [ -o output-keyfile ] [ -O type | -l | -L | -p ]
  -t    specify key type when generating (rsa, dsa, rsa1)
  -b    specify number of bits when generating key
  -C    change or specify key comment
  -P    change key passphrase
  -q    quiet: do not display progress bar
  -O    specify output type:
           private             output PuTTY private key format
           private-openssh     export OpenSSH private key
           private-sshcom      export ssh.com private key
           public              standard / ssh.com public key
           public-openssh      OpenSSH public key
           fingerprint         output the key fingerprint
  -o    specify output file
  -l    equivalent to `-O fingerprint'
  -L    equivalent to `-O public-openssh'
  -p    equivalent to `-O public'

But I have no idea whatsoever on how to do what the website tells me to do and all my tentatives failed so far.

How do I do what the website tells me to do, using puttygen on the terminal?

up vote 66 down vote accepted

Using the GUI

See this SO Q&A on how to do exactly what you want, titled: Convert PEM to PPK file format.

excerpt

  1. Download your .pem from AWS
  2. Open PuTTYgen, select Type of key to generate as: SSH-2 RSA
  3. Click "Load" on the right side about 3/4 down
  4. Set the file type to *.*
  5. Browse to, and Open your .pem file
  6. PuTTY will auto-detect everything it needs, and you just need to click "Save private key" and you can save your ppk key for use with PuTTY

Using the command line

If on the other hand you'd like to convert a .pem to .ppk file via the command line tool puttygen, I did come across this solution on SO in this Q&A titled:

excerpt

$ puttygen keyfile.pem -O private -o avdev.ppk

For the public key:

$ puttygen keyfile.pem -L

References

  • steps 2 to 6 also work for other private key file types (e.g. resulting file from a Git Bash ssh-keygen command), thanks! – AtAFork Sep 23 '16 at 0:06
  • doesn't work anymore from the command line – Aryeh Beitz Mar 29 '17 at 16:00
  • Any thoughts on how this would work on OSX, PuTTYgen isn't available – Qasim Jun 21 '17 at 10:51

If you are using GNU/Linux, you don't have to use Putty. That part of the tutorial is geared towards Windows users.

Just set your .pem file permissions to r-- by doing chmod 400 mykey.pem then you can pass it straight to ssh :

ssh -i mykey.pem user@aws-host.amazon.com 
  • The reason I am trying to use putty is so I can follow the instructions in this plex tutorial. If there are other ways of doing it, then please feel free to explain. – Flame_Phoenix Feb 21 '14 at 16:47
  • Your Plex Media server is on the AWS machine and you're trying to tunnel to it from your Mint workstation, am I getting this right ? You should open another question explaining this, but there are already many questions explaining how to do SSH tunneling. – François Feugeas Feb 21 '14 at 16:57
  • 1
    By using the command that you mentioned i was able to login in to the remote AWS instance. I actually wanted to transfer files i used the command (just in case it helps someone) sftp -oIdentityFile=mykey.pem user@<publicIP> ... thanx your post helped me solve the problem i was having for more than 5 hours. – Subham Tripathi Jan 6 '15 at 9:25

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.