SSH vs. Putty private key files (.ppk) on MAC OS X

Servers Add comments

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”).

5 Responses to “SSH vs. Putty private key files (.ppk) on MAC OS X”

  1. Brian Deacon Says:

    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.

  2. Rocco Says:

    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.

  3. Changing PuTTy ppk file to OpenSSH format (on your mac) | kennethteo.com Says:

    [...] http://www.g-roc.com/29_ssh-vs-putty-private-key-files-ppk-on-mac-os-x.html [...]

  4. Nikita Rybak Says:

    Thanks a lot!

  5. How to connect to Amazon EC2 from Mac OS X « FeedMind Says:

    [...] 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 [...]

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS