Use your PuTTY SSH Key on MacOs

I have had the problem authentication with my ssh server with a private key. It asks password despite no password needed. Here is the log:

mememe@Mac:~$ ssh -v -i ~/.ssh/id.ppk root@remote.machine.com
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/<username>/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug1: Connecting toremote.machine.com [999.1.1.1] port 22.
debug1: Connection established.
debug1: identity file /Users/<username>/.ssh/id.ppk type -1
debug1: identity file /Users/<username>/<username>/id.ppk-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
Host sfs
debug1: Server host key: RSA 43:xx:72:xx:xx:b0:xx:8a:xx:xx:xx:xx:xx:xx:a7
debug1: Host 'remote.machine.com' is known and matches the RSA host key.
debug1: Found key in /Users/<username>/.ssh/known_hosts:5
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/<username>/.ssh/id.ppk
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug1: No more authentication methods to try.
Permission denied (publickey).

So it appears that, I tried to use PuTTY gen generated key file with OpenSSH. Therefore, without windows I had to use the steps:

1) This installs putty along with puttygen: (MacPorts needed)

$ sudo port install putty

2) This converts my ssh keygen into OpenSSH key type:

$ puttygen id.ppk -O private-openssh -o id_openssh 

now done. let’s go:

$ ssh -i ~/.ssh/id_openssh root@remote.machine.com

goes ok for me.

Advertisements

Leave a Reply

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s