Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I for the life of me can't seem to get openSSH to work on Ubuntu Server 10.10 with keys I generated in PuttyGen on my Windows machine. After hours of trial and error and web searches I can't get my ssh service to accept my private key!

Here is my sshd_config.

I generated my public and private keys using Putty in Windows then used a ssh connection to paste my key from putty directly into my authorized_keys2 file located in */etc/ssh/publickeys/authorized_keys2*

The authorized_keys2 file looks something like: ssh-rsa AAAAB3NzaC1yc2EAAAA... with no email or anything at the end of it. I just pasted it straight from PuttyGen without using a key comment.

I feel like it's not working because of some nuance I am not understanding or some unusual setting or incompatibility. I've restarted the ssh service (and the machine) to no avail.

What are some common pitfalls I might have gotten myself into? Is there a simpler way to generate ssh keys that putty can use in windows?

share|improve this question
add comment

4 Answers

I solved it. My problem was that I needed to convert the public key to OpenSSH's format. This required the use of the following command: ssh-keygen -i -f puttygen_key > openssh_key which converted my putty generated key into an openssh key which I then simply renamed to authorized_keys and boom it works.

share|improve this answer
    
Thanks. Should have known that option in ssh-keygen before! –  gertvdijk Sep 16 '12 at 11:25
add comment

The above is not working for me, i copied the pub..key into my .ssh/authorized_keys Then went to putty and still not allowed excess. Been banging my head for near 3 days now. lol

I think my problem is understanding what user sudo is doing what. I have a key pair made and working from my home pc [linux] which was so easy using sudo jamjam$ Do i need to mkdir .ssh for sudo user for the laptop? and then chown -R etc etc etc..

At the minute i sitting with the 2 keys made from putty, uploaded private key into Pageant and once again playing with my nuts where to stick the second one. hahaha. Anyone help please, ? The second public key is stored on USB and as been copied to .ssh/authorized_keys and thats me for tonight. Any help would be great people.

share|improve this answer
add comment

You must write the content of your name_of_key.pub into your ~/.ssh/known_hosts file and that's it the workaround is similar to:

  1. Install openSSH (done as you point)
  2. Generate an rsa in the client machine to share.
  3. Copy the content of the name_of_key.pub into the ~/.ssh/known_hosts in the server.
  4. Enjoy fully authorized communication with the server from the client machine.

More on creating sshkeys with PuTTYgen here and there (note that you just need to change the step when you copy the text to the server, now the server is linux!)

You also can use google's Secure Shell, here you can find how to share a key-pair using it.

share|improve this answer
    
Does the known_hosts file need to be one line? Puttygen creates a multi-line file for the .pub key. Also, is this file required to be in ~/.ssh/known_hosts because my authorized_keys file is in /etc/ssh/publickeys –  warpstack Sep 16 '12 at 5:01
add comment

Soory the above not work to, and after uploading the key to authorized_keys2 and chmod 600 and then mv authorized_keys2 .ssh/authorized_keys then i found my key was not working. lol and no back door to get into server, or so i thought, i found one, took it back out and made a new key for my linux home pc, i have also tried the steps above into .ssh/known_hosts and now tried on laptop putty, no work!! hahaha, really this is peeing me of, i know its something simple. I also changed in /etc/ssh/sshd_config Ignoreuserknownhosts no

Any idea people, i have the key still sitting on pen drive and still in known-hosts [file]

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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