3

Possible Duplicate:
How to convert .ppk key to OpenSSH key *under Linux*?

(unix, here: ubuntu 10.4)

I know how to create ssh key pairs in unix (ssh-keygen) and how to do it in windows (puttygen). the missing part in my case would be how to use a keypair, generated in windows (puttygen), in a unix shell.

where do I need to put the public key, in this particular case, to use it as an ssh-key in git.

perler
  • 251

3 Answers3

6

The Puttygen window contains a text area with the public key in the format expected by SSH.

Copy it, and add it to the file ~/.ssh/authorized_keys on the server on its own separate line. Make sure the file and the directory are not readable/writeable by group and others, i.e. run chmod go-rwx ~/.ssh ~/.ssh/authorized_keys.

Then the server will accept your login using the private key for authentication.

Daniel Beck
  • 111,893
6

Depending on which key you need...

Private key – to log in from a Unix system into another Unix

You must first convert the key, using PuTTYgen, from PuTTY format to one OpenSSH can use.

  • In the Windows version of PuTTYgen, use the Conversions → Export OpenSSH key menu item;

  • in the Linux version, puttygen mykey.ppk -O private-openssh -o mykey.

Only public key – for logging in from Windows to Unix

See Daniel's answer.

grawity
  • 501,077
3

Ok, I think I didn't make myself quite clear but found the solution:

  1. start puttygen
  2. load private key
  3. Menu Conversions|Export OpenSSH key
  4. Save somewhere, Open, Copy content to clipboard, paste on linux into file: $HOME/.ssh/id_dsa
  5. (optionally) copy content of text area "Public Key for pasting into OpenSSH authorized_keys file", paste on linux into file: $HOME/.ssh/id_dsa.pub

you can now use this SSH key from a shell to login into remote systems.

side note: to seamlessly use git from windows putty in a linux shell to connect to git set these options in putty session:

enter image description here

(and you must put the public key in ~/.ssh/authorized_keys, sure..)

perler
  • 251