Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by Oliver Salzburg Nov 30 '12 at 15:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

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.

share|improve this answer
    
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. copy content of text area "Public Key for pasting into OpenSSH authorized_keys file", paste on linux into file: $HOME/.ssh/id_dsa.pub –  perler Feb 1 '12 at 22:29
    
you can now use this SSH key from a linux 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: i.imgur.com/lh5LT.png (and you must put the public key in ~/.ssh/authorized_keys on the linux system and in git under public keys) (will put this as self answer, when I'm allowed, karma-wise) –  perler Feb 1 '12 at 22:29
    
@perler: Users are always allowed to answer questions, including their own. Also, the .pub file is optional. –  grawity Feb 1 '12 at 22:43
1  
no you can't for 8 hours with karma below 100, big letters told me ;) –  perler Feb 2 '12 at 8:28

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.

share|improve this answer
    
Definitely use this if connecting from Windows to Unix. –  Lester Peabody Feb 23 '13 at 3:32
up vote 3 down vote accepted

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..)

share|improve this answer
    
Which is kind of what grawity and I wrote ;) –  Daniel Beck Feb 2 '12 at 17:24
    
you talked only about logging INTO a machine and grawity missed the important part of the question: where to put the files. thanks anyway.. –  perler Feb 2 '12 at 21:21
    
(The answer being "absolutely anywhere".) –  grawity Feb 7 '12 at 15:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.