I have been using Putty on Windows XP and used the .ppk file to connect to my Linux servers (several servers).

On the servers I have the following folder and file ~/.ssh/authorized_keys

I now want to use a Mac to connect via the terminal. I have set up the remote connections to the servers manually and want to know how I can setup using the ppk file or the private/public key within it.

Please note : I already am using private/public key login from Windows so I do not need to create a new key using keygen, I just want to know how to set up now that I have the keys already. (In other words, I already have the authorized key lists on the server, and the public and private key).

3 Answers
3

You can ssh directly from the Terminal on Mac, but you need to use a .PEM key rather than the putty.PPK key. You can use PuttyGen on Windows to convert from .PEM to .PPK, I'm not sure about the other way around though.

You can also convert the key using putty for Mac via port or brew:

sudo port install putty

or

brew install putty

This will also install puttygen. To get puttygen to output a .PEM file:

puttygen privatekey.ppk -O private-openssh -o privatekey.pem

Once you have the key, open a terminal window and:

ssh -i privatekey.pem user@my.server.com

The private key must have tight security settings otherwise SSH complains. Make sure only the user can read the key.

There is a way to do this without installing putty on your Mac. You can easily convert your existing PPK file to a PEM file using PuTTYgen on Windows. So the best way to do it on mac is to do it on windows?!
– Roee GavirelApr 23 '17 at 11:06

4

Actually @sigi my answer was genuinely intended to be helpful. The primary goal of the question as I understand it is to connect from a Mac to a Linux server using an existing .ppk file from a Windows machine. Given the question asker has access to a Windows machine then converting the .ppk file to a .pem file prior to copying it to the Mac is just as valid a solution as first copying it to the Mac and converting it there. I suggested this approach because some people may prefer not to install additional software on their Mac that they don't otherwise need.
– dasfrostySep 8 '17 at 5:05

This answer is very helpful, for exactly the defended reason: Someone coming from Windows to Mac with an existing ppk file is more likely to want to export from Windows as opposed to installing PuTTY on the Mac for no particular purpose. This is exactly what I chose to do.
– trevorskyJul 2 at 14:38