PuTTY SSH Keys

2 views
Skip to first unread message

Aaron Toponce

unread,
Dec 1, 2009, 6:16:43 PM12/1/09
to oa...@googlegroups.com
So, at work, I use PuTTY on my Windows laptop to navigate the forest of
SSH servers on the network. Naturally, I've setup SSH keys using
'puttygen' and authenticate using 'puttyagent'. Works great.

Recently, I had to blow away my VirtualBox VM (by the way, version 3.1
is loaded with awesome), and failed to backup my SSH keys from that box.
Rather then regenerate, and repropogate to all the servers on the
network, I should be able to use the existing PuTTY keys I've setup on
my Windows box. No?

So, my question is this: how can I import the PuTTY keys into my Debian
SSH client. Just copying the private key into my ~/.ssh/ directory,
renaming, and giving it the appropriate permissions fails with
'ssh-add', saying the passphrase I'm giving it is bad, which it isn't.
So, I'm guessing the format is different, and it's not reading the key
correctly, or something. Anyone have success here, or know the
appropriate path to take?

Thanks,
--
. O . O . O . . O O . . . O .
. . O . O O O . O . O O . . O
O O O . O . . O O O O . O O O

signature.asc

Jonathan Karras

unread,
Dec 1, 2009, 9:19:58 PM12/1/09
to oalug
Putty ssh keys are in a different format from OpenSSH keys. So you
will have to use puttygen to convert the private key into the other
format. Which I know it can convert the public key for import into the
authorized_keys file but I am unsure about the private.

Jonathan

Aaron Toponce

unread,
Dec 21, 2009, 1:33:16 PM12/21/09
to oa...@googlegroups.com
Aaron Toponce wrote:
> So, my question is this: how can I import the PuTTY keys into my Debian
> SSH client. Just copying the private key into my ~/.ssh/ directory,
> renaming, and giving it the appropriate permissions fails with
> 'ssh-add', saying the passphrase I'm giving it is bad, which it isn't.
> So, I'm guessing the format is different, and it's not reading the key
> correctly, or something. Anyone have success here, or know the
> appropriate path to take?

I figured this out, in case anyone is curious. With the PuTTY suite of
utilities, provided is a tool called 'PuTTYGen'. It generates SSH keys
for SSH key authentication, but it is its own thing, which is not
compatible with OpenSSH or SSH.com key agents.

In that utility, load up your private key, then you can export it to an
OpenSSH or SSH.com compatible file. SCP that file over to your OpenSSH
client box to the ~/.ssh/ directory, and 'ssh-add' the new key. So, in
my case, it was exported as 'id_rsa'.

You can then copy/paste the public portion of the key, as printed in the
utility, save that to a different file (id_rsa.pub), and put that in
your OpenSSH client machine's ~/.ssh/ directory as well.

Don't forget to set the appropriate permissions. OpenSSH wants only user
access, and not group or other access to either file, before 'ssh-add'
will work.

Cheers!

signature.asc
Reply all
Reply to author
Forward
0 new messages