Convert Putty .ppk Private Key To A Normal SSH .ssh Key You Can Use On An Apple Mac

Posted on

This is from another article which I found very useful yesterday.
The original article is found here.

Also, how to connect to a server using SSH on a Mac

I spent ages trying to figure this out so that I could SSH onto my production hosting server from my iBook. Now that I know what was wrong, I can’t believe how long it took me to solve, because the answer is so simple – but unfortunately I never found anything in Google that helped me, it was only pure luck and dogged perseverance that helped me figure this one out.

I found I

already knew that I could open an SSH connection on my Mac using Terminal, and I could SSH onto my production server from my XP pc using Putty with no problems.

So when I copied my .ppk Putty key from my PC to my Mac I expected to be able to type:

ssh -2 username@123.123.123.123 –i yourkey.ppk

from within Terminal and get straight onto my server with no questions asked.

But oh no! it’s not quite as easy as that – well these things never are, are they?

Let start with the very basics, you can find the Terminal program on your Macintosh in Applications -> Utilities.

Open it and you have something resembling a Windows DOS prompt.

Now if you already have a .ppk file from your PC that you want to convert to use on your Mac you need to visit the Putty Website www.chiark.greenend.org.uk/~sgtatham/putty/download.html and download puttygen.exe (on your PC) now open it, and using the File menu, load your .ppk that you already use, and type in your pass phrase.

Now go to the Conversions menu and export the key as an OpenSSH key – hey presto – you now have a key file that will work on your Mac! Such a simple solution, yet that took me so long to figure out …

Anyway, now you just need to copy your new .ssh keyfile over to your home (~) directory on your Mac and set the permissions to 700 (chmod 700 yourkey.ssh).

Once you’ve done all that you can use the ssh command.

 ssh -2 username@123.123.123.123 –i yourkey.ssh 

and you should be able to SSH onto your box as you would from your PC – amazing!

Advertisements

Leave a Reply if you find this useful

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s