Friday, May 11, 2007

Using Putty Private keys on Mac OS X

I spent quite a bit of time this morning working on an issue with my ssh private keys. I originally generated them using Putty and worked from a Windows XP box. I needed to use these same private keys on my MacBook Pro. I didn't really find any precise documentation on doing this so perhaps these steps will help anyone else that needs to use their private keys with two different operating systems.

1. On the Windows side open puttygen and load your private key.
2. Select "Conversions" menu and "Export OpenSSH Key" from that menu. Save the file somewhere on your hard drive.
3. Copy the public key from the diaglog box and paste that into notepad. Save that file with the other as the public key.
4. Copy both these files to the Mac (maintain carriage returns). For ease of use name these files id_dsa (for the private key file) and id_dsa.pub (for the public key file) and store them in /Users/username/.ssh.
5. Permissions should be rw for owner and r for all.

Note about user name.
If the system you are logging into is using a different user name be sure and include that on the ssh command line. For instance if my user name on my osx login is bob but the remote host expects fred I have to use the login parameter of ssh as follows:
ssh -l fred

8 comments:

Anonymous said...

A 1000 thank yous for this great tip! I have been going nuts trying to solve this problem. Finally, after about my 20th Google search ("putty" + Mac -knife) your blogged slapped me in the face.

I bow before you.

Robert

<a href="http://erniz.com">Hilbert</a> said...

Hello! I read this article! Big thanks to author, very interesting. Write more.

Anonymous said...

Thanks for the post. This helped!

-Michael

Brij said...

Buddy - you just made my day!

Thanks

Garrett Reid said...

I was trying to figure out how on earth to use a ppk, and was lucky enough to find your page on a google. You saved me quite a bit of time; thanks for the great post!

--JOsh said...

Great tip. I'm not sure if something is different in my OpenSSH setup, but I had to change my local key file to have 600 permissions.

--JOsh

Scott said...

Kevin, you made my day too. Thanks much for the post.

Like Josh I too had to 'chmod 600' on my private key file, and did the same for the public key file just for good measure. With that, I'm in! Thanks again.

-Scott

Anonymous said...

thanks a million. took me quite some time and then..... I found your blog.

greetz from holland.

joost

 
Clicky Web Analytics