51

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?

slm
  • 363,520
  • 117
  • 767
  • 871
Flame_Phoenix
  • 859
  • 4
  • 9
  • 13
  • Related: http://unix.stackexchange.com/questions/74545/what-difference-between-openssh-key-and-putty-key/74560#74560 – slm Feb 21 '14 at 17:50

3 Answers3

71

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

slm
  • 363,520
  • 117
  • 767
  • 871
15

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 [email protected] 
  • The reason I am trying to use putty is so I can follow the instructions in this [plex tutorial](http://infoliser.com/how-to-install-plex-media-server-on-a-centos-6-x-server-and-enable-internet-access-using-ssh-tunneling-with-putty-and-firefox/). 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@` ... thanx your post helped me solve the problem i was having for more than 5 hours. – Subham Tripathi Jan 06 '15 at 09:25
0

use the below command its worked for me in ubuntu

puttygen /home/abc/Downloads/dockerkey1.pem -o home/abc/Downloads/dockerkey1.ppk -O private

Example

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

thrinadhn
  • 101
  • 1