As part of helping a friend with some system support soon, I was sent a set of ssh keys so that I can access their Ubuntu servers.  The keys, however, are .ppk keys generated by PuTTY, the popular Windows SSH telnet/ssh client.

Unfortunately, the PuTTY keys don’t work for me as I’m using OS X … insert appropriate Mac-hating statement here, if you must.  😉  Needless to say, I had to find a way of using those keys so I could access the servers without any problems.

Fortunately for me, I’ve encountered this situation before.  While testing some connectivity issues recently I kept getting denied access.  The problem is that the keys need to be converted to OpenSSH format before they’ll work with command-line ssh in OS X.

To fix the issue, you’ll need PuTTYGen from the PuTTY website (don’t worry, it’s free).  If you don’t have it already, grab it, and follow the simple steps below (I’ll include the step to download, just in case you missed it).

Note: You’ll need access to a Windows machine for the below steps to work.

  1. Download PuTTYGen from the PuTTY website.
  2. Run PuTTYGen.exe, and open the .ppk file using the open option on the File menu.
  3. From the Conversions menu, export the key in OpenSSH format – it’s what you need for the key to work with OS X.

Once you’ve done all that, you should be able to run ssh from the OS X command line and connect without any problems.

Note: There are a ton of people who have experienced this issue and nearly every other website will tell you that you need to set the permissions on the .ssh file to 700.  In most cases 600 is enough.  If you don’t do this, you can receive an error like this one:

ssh Error
ssh Error

That’s all there is to it – easy.