Post
Topic
Board Mining
Re: Putty + Ubuntu +SSH + Public/Private Keys = Not Working (Server refused our key)
by
Rob P.
on 24/07/2011, 00:45:32 UTC
I'm pretty sure that is completely wrong since the id_rsa* files .ssh are the public/private key files of THAT machine, and do not specify which public key is allowed to connect. They would only be used if you ssh'd from that machine to somewhere else. Furthermore there should be no need to create ANY keys whatsoever on the host machine.

Nope.  They're the converted public/private key pair from the Windows computer.  He didn't run ssh-keygen, hence he doesn't HAVE a public/private key pair for the Ubuntu system.

Rather, you want to append your public key you created with putty on your client machine to the authorized_keys file in the ~/.ssh directory on the host machine. If that file does not exist create it and then run "chmod 600 authorized_keys". Depending on the format putty uses you might have to convert it to the openssh format first. There should be one key per line in the authorized_keys file, e.g. it should look similar to this:

Code:
ssh-rsa AAA[lots of characters]== bla@foo

So basically: append the .pub file you created on the client machine to the authorized_keys file of the host machine

Yea, that's what I told him to do.  The problem is that he has a combined key created by Putty.

Putty under Windows just generates a .ppk file.  
You can read more here:  http://www.chiark.greenend.org.uk/~sgtatham/putty/faq.html#faq-ssh2-keyfmt

The instructions allow you to take that .ppk file and convert it to a valid OpenSSH public/private key pair (the id_rsa.pub and id_rsa).

You are right however, there is a step missing:

Code:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

That puts the public key into the authorized_keys file as a public/private key pair that is allowed to connect to the account.  In fact, after you do that step you can actually delete the id_rsa and id_rsa.pub if you wish, because they ARE for the Windows system.