Using SSH Shortcut in Mac OS with a .ppk File

19,092

Solution 1

To use ppk keys generated with Putty on Mac OS X, you need to convert them first:

After launching puttygen.exe (...) 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”).

Solution 2

First, notice that you have an error
Warning: the RSA host key for '[server]:10400' differs from the key for the IP address...

That means that the server's public key does not match it's ip address. To resolve that, edit your ~/.ssh/known_hosts file and remove the entry for 192.168.1.40

You could do this with one command

ssh-keygen -R 192.168.1.40

Second there is a better way to connect to a server by using RSA keys instead of .ppk keys.

According to filext.com

The PPK file type is primarily associated with 'PuTTY'. PuTTY is a terminal emulator application which can act as a client for the SSH, Telnet, rlogin, and raw TCP computing protocols.

You didn't specify, but I am assuming that you wish to log into a linux web server from a Windows and a Mac computer simultaneously?

A better way to setup keys would be to take the public key of your ssh server, and place it into the known_hosts file of your Mac.

You could then setup pass wordless ssh by taking your Mac's public key and appending it to the authorized hosts file on the linux web server.

Here is how to copy your Mac's public key to the authorized hosts on the linux server in one command

cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

Resources

http://www.commandlinefu.com/commands/view/188/copy-your-ssh-public-key-to-a-server-from-a-machine-that-doesnt-have-ssh-copy-id

Share:
19,092

Related videos on Youtube

Kirk Ouimet
Author by

Kirk Ouimet

The internet is a miracle.

Updated on September 18, 2022

Comments

  • Kirk Ouimet
    Kirk Ouimet over 1 year

    I'm working on setting up a shortcut to be able to SSH into my web development server. Here is what my config file looks like (different port and path to key in the real thing):

    enter image description here

    Here is what happens when I run "ssh server"

    enter image description here

    I didn't use a password when I used puttygen to create the private key, so I just press OK. And then I get this error:

    enter image description here

    Is the problem here that I am using a .ppk file and I should be using something else?

    • Paulo Almeida
      Paulo Almeida almost 11 years
      Is the public key in your user's authorized_keys on the server?
    • Kirk Ouimet
      Kirk Ouimet almost 11 years
      @PauloAlmeida yes it is, I am able to connect to the server with PuTTY on a Windows box using the same .ppk file
  • Paulo Almeida
    Paulo Almeida almost 11 years
    That method to copy the public key won't work if the server doesn't allow password authentication. Of course he can still copy the key some other way.
  • Kirk Ouimet
    Kirk Ouimet almost 11 years
    @Spuder, this was an awesome answer and so helpful. The reason I am not checking it is because Paulo's answer directly solved my issue. If I could check both, I would. :) Thank you!