Using a Putty private key in Android ConnectBot

I have been trying to import a private key into ConnectBot for Android.
The key I’m using is working fine when using Putty, but does not work for ConnectBot.

To make it work for ConnectBot, you need to have a OpenSSH version of this file.
Luckily one can also use PuTTYgen to create an OpenSSH key.

Puttygen

In Puttygen, do the following:

  1. Load the private key: [File] -> [Load Private Key] (*.ppk)
  2. Enter passphrase if applicable
  3. Goto: [Conversions] -> [Export OpenSSH key] and save

Android

Now find a way to get this OpenSSH key to your Android /sdcard (root) folder.

ConnectBot

In ConnectBot, do the following:

  1. [Menu] -> [Manage Pubkeys]
  2. [Menu] -> [Import]
  3. Choose the OpenSSH key from /sdcard
  4. Click the red lock icon to load the key into memory (lock icon turns green)
  5. Enter passphrase/password if applicable
  6. (Disconnect current session)
  7. Connect!

You don’t assign a private key to a connection, but ConnectBot will just try any loaded key instead.

Cheers!

Tagged , , . Bookmark the permalink.

19 Responses to Using a Putty private key in Android ConnectBot

  1. new2openssh says:

    Please help I’m literally pulling my hair out and keep on getting timed out. I don’t have a password. Putty connecting through lan works ok with the priv key but when connecting with connectbot keeps timing out. I can ping both my dyndns name and ip associated with it currently and it’s ok. I know that you don’t need to open ports if you do the tunnelling.
    Don’t know what else to do.

    Thanks.

    • Ian Hoogeboom says:

      Are you sure you access the machine through lan (wi-fi) when connecting with connectbot? Aren’t you using a data connection set up by your device using the data connection from your provider?

  2. 5169.info says:

    Is connectbot only work with lan/wifi ?

    • Ian Hoogeboom says:

      It also works when connected through a mobile operator. I have it working with T-Mobile Netherlands.

      When you use your router’s outside/WAN ip address as ‘host’ and a ‘port’ which are both forwarded/redirected (called NAT) on your router to the machine you have ssh running on, you should be able to connect!

  3. voytek says:

    thanks, excellent guide

  4. noname says:

    Good. Thank you!

  5. rsturk says:

    Thanks for posting this information! I wouldn’t have known to generate the OpenSSH key otherwise.

  6. xicobandito says:

    Thank you. Worked like a charm.

  7. pimptastic says:

    this worked perfectly. Thank you for your assistance.

  8. Frapi says:

    Thanks a lot !
    I did not notice the point of the different key format between putty and open ssh

  9. Grisbouille says:

    Great guide, thanks for that explanation.
    However, what way could I devise if I don’t have access to a windows pc (I.e. can’t run puttygen)??
    I’ve been on the lookout for an android equiv. but nothing so far… Any idea how to bypass the absence of windows?

    • Ian Hoogeboom says:

      Hi, on Linux you can use “ssh-keygen -i -f input_keyfile > output_keyfile” to generate an OpenSSH keyfile.

  10. klipse says:

    Well done! This has really solved my needs on the fly. I converted my putty key and it works like a charm. Thanks!

  11. Subhash Surampudi says:

    Thank you. This was very helpful.

  12. Sardog says:

    Thanks, it worked just like you explained. I used Openbox by the way to move my key quickly and then deleted the key off of Openbox. I know, I know, maybe not the most secure way but at least I could do it all remotely with my laptop and and tablet in hand, while watching TV.

  13. Yuengling says:

    Hi. Your instructions say “Now find a way to get this OpenSSH key to your Android /sdcard (root) folder.” – can you kindly explain how to do this? I have been unable to locate any helpful instructions.

    • Ian Hoogeboom says:

      Hi. You can do this is a lot of different ways. You can mail the file to yourself and open the mail on your phone and save it on the SDcard (I use ES File Explorer to move files around on my phone); you can take the SDcard out and put it into your PC, copy it on the SD card and place the SDcard back in the phone; you can connect the phone to your PC with USB and save the file in the SDcard folder… etc… a lot of different ways to do this.
      Regards, Ian.

  14. Muhammed Riyas says:

    Hi,

    Thanks for this blog. I was using this app and everything was fine. From last week, I can’t import the openssh key. I tried by reinstalling this app, but not work. Can you help me to solve this.

    • Ian Hoogeboom says:

      Hi Muhammed,

      I just added a key for a jumphost and it did work. Can you be more specific on what didn’t work for you?
      Did you ‘load the key into memory’, by pressing the red ‘lock’ icon to turn it green?

      Regards, Ian.

Leave a Reply

Your email address will not be published. Required fields are marked *