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'm running Ubuntu 13.04 in an OpenStack instance. When I created the instance, I specified a keypair, and I may ssh into the box with the command:

[laptop]$ ssh -i keypair.pem ubuntu@my-instance

I don't know what magic OpenStack did to make this work, but it just does. Now I would like to set up "normal" public-key authentication. I can't even get this to work so as to login from the instance to localhost; it always asks for my password! I tried:

[my-instance]$ cd ~/.ssh
[my-instance]$ ssh-keygen -t rsa
[my-instance]$ echo id_rsa.pub >> authorized_keys
[my-instance]$ ssh localhost
Password: _

I do this all the time with "normal" servers; I checked that the permissions on the private key and authorized_keys files, and also tried dsa & ecdsa keys. The output of ssh -v is not very illuminating (see below). Can anyone shed some light on my situation?

...
debug1: Found key in /home/ubuntu/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/ubuntu/.ssh/id_rsa (0x7f86d8041ec0)
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ubuntu/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug2: we did not send a packet, disable method
debug1: Next authentication method: keyboard-interactive
...
share|improve this question

1 Answer 1

up vote 1 down vote accepted

This line looks suspect:

echo id_rsa.pub >> authorized_keys

You might mean something like:

cat id_rsa.pub >> authorized_keys

You might also want to edit authorized_keys and remove the line that says id_rsa.pub

share|improve this answer
    
Oh dear goodness, that was a silly typo! Thanks for that :) –  chase Aug 17 '13 at 10:16

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.