I had some problems lately trying to connect to a customer’s server via SSH on my mac running Mac OS X 10.4.11. I was trying to use the provided .ppk file in mac’s OpenSSH command line tool, which didn’t work and just told me: “Permission denied (publickey).” after promting me to “Enter passphrase for key ‘[keyfile.ppk]‘”… so I looked around a bit and after a while came across a great little article on the topic right here.
So in order to use the private key file for putty.exe (the .ppk file) you need to convert it to a OpenSSH file first. The tool you need is called PuTTYgen and only runs in Windows. I have not come across a mac app to do that (too bad). Anyways, the only thing you have to do after launching puttygen.exe is to open the .ppk file, enter your passphrase and go to “Conversions” in the menu. Then save the file as an OpenSSH file.
Finally, after you put the .ssh file on your mac, you need to restrict the .ssh file’s permissions (“Get Info”, then under “Ownership & Permissions”->”Details” set “No Access” for both “Group” and “Others”). Otherwise OpenSSH won’t let you use the file. Now you can connect to the server using this command line:
comp:~ your$: ssh -2 -i /path/sshfilename.ssh user@server.domain
Option “-2″ is not required, at least for me and in this case. It forces ssh to protocol version 2, but it works without. This depends on the protocol the server requires and you need to try this. Also check out the ssh manual (type “man ssh”).
June 1st, 2008 at 12:08 pm
Worked like a charm. Another helpful tip for you is that puttygen is available through macports. I found that I already had it when I installed putty through ports.
June 1st, 2008 at 12:23 pm
thanks brian, just tried that and it works. you just have to do a “sudo port install putty” and puttygen is installed alongside putty and puttytel. great now it can be done sans windows entirely.
July 9th, 2008 at 12:41 pm
[...] http://www.g-roc.com/29_ssh-vs-putty-private-key-files-ppk-on-mac-os-x.html [...]
April 30th, 2009 at 11:12 am
Thanks a lot!
August 6th, 2010 at 1:02 pm
[...] I found the correct information in a blog post, you need to use Puttygen to convert the Amazon .ppk file to OpenSSH format. The OpenSSH format can [...]