Wednesday, June 25, 2008

Use PuTTY generated keys with SftpDrive

So you created a public/private key pair using PuTTYgen and now you want to use these keys in other applications like OpenSSH and/or SftpDrive but you realise that the private key generated by PuTTYgen is not compatible with these programs??

No worries... all you have to do is convert your PuTTYgen key (.ppk) to and OpenSSH compatible key and it happens to be that PuTTYgen can do this conversion.



Open PuTTYgen and load your private key using the "load" button and opening your private key .ppk file. Once loaded select from the top menu "Conversions -> Export OpenSSH key" and select a file name to save the exported key. Now this saved key can be used in other applications that are OpenSSH compatible.



To use this key with SftpDrive open SftpDrive Manager and on "New Driver" change the Authentication method (see image above) to "Use a public key to log in...". This will open a dialog box (see image below).



Here you can generate a new public/private key pair but we want to use the one we generated with PuTTYgen so select "Import Existing Key Pair" that will open yet another dialog box (see image below):



Here simply browse the location of the private and the corresponding public keys and press "OK". Now SftpDrive will use these keys to connect to your SSH server.

If you get errors make sure you have selected the exported OpenSSH compatible key and not the PuTTYgen generated one (i.e. .ppk). Also if you saved the public key using the PuTTYgen "save public key" button then this key has a format SftpDrive does not understands so it will be unable to read the key. To solve this copy and paste the public key as it appears in PuTTYgen text box (i.e. the large string starting with ssh-rsa or ssh-dsa) in a text file (i.e. mykey.pub) and then import that file as the public key. This format is OpenSSH compatible so should work with no problems.

2 comments:

  1. Anonymous1:58 AM

    Thanks for sharing, very informative step-by-step guide.

    ReplyDelete
  2. Anonymous2:14 AM

    I have installed SSH server on Windows 2003 using CopSSH.

    CopSSH forums:
    http://itefix.no/i2/node/11260
    Submitted by tk on Wed, 23/04/2008 - 00:34.

    [quote]
    Re: authorized_keys vs authorized_keys2

    Older versions of openssh has differentiated files for authorized keys by version (authorizzed_keys for the version 1, authorized_keys2 for the version 2).

    You can simply ignore authorized_keys2 as the newer openssh version use authorized_keys only.
    [/quote]

    ReplyDelete