1

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

1 Answer 1

1

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

1
  • Oh dear goodness, that was a silly typo! Thanks for that :)
    – chase
    Aug 17, 2013 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .