Cannot ssh to ubuntu 14.04 using private key. Password prompted

asked 2016-11-06 15:29:40 -0600

Manish Lamichhane gravatar image

updated 2016-11-06 15:51:38 -0600

Hello Everyone. Below is what I have done so far and what is the problem I am facing in detail:

In OpenStack:

I create a new Ubuntu 14.04 instance in OpenStack Nova, created appropriate security group with ssh port open and associated a floating IP to the instance. I also created an RSA key(this was in my client machine), copied the content of public key(cloud.key.pub) generated, to the "key pair" section of the instance.

In Client machine:

I checked the permissions of ~/.ssh folder to be 700 and copied the private rsa key (cloud.key) inside ssh folder and checked the permission of this file to be 600. In the /etc/ssh/ssh_config file, I modified:

IdentityFile ~/.ssh/cloud

to force ssh to look for the .ssh/cloud.key file to make ssh connections. Then:

ssh -v ubuntu@<floating ip of my instance>

Following is the output of terminal:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 77.234.202.163 [77.234.202.163] port 22.
debug1: Connection established.
debug1: identity file /home/manishlamichhane/.ssh/id_rsa/cloud type -1
debug1: identity file /home/manishlamichhane/.ssh/id_rsa/cloud-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA e0:16:67:22:81:e1:a0:a6:ad:02:e6:a3:08:82:b7:d2
debug1: Host '77.234.202.163' is known and matches the ECDSA host key.
debug1: Found key in /home/manishlamichhane/.ssh/known_hosts:33
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: manishlamichhane@manishlamichhane-Inspiron-3543
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/manishlamichhane/.ssh/cloud
debug1: Next authentication method: password
ubuntu@77.234.202.163's password:

Alernatively, before editing the ssh_config file, I generated a key file in OpenStack and tried explicitly providing the location of .key file as:

ssh -i <path to key file> ubuntu@instance.ip.address

UPDATE: http://serverfault.com/questions/641127/ssh-public-key-login-fails-without-rn

Reading the above link, I have high suspicion this is a server side issue. But the funny thing is, I can't access the server at all.

Both methods failed. My suspicion is OpenStack is not registering the public key. I am kinda stuck here for a couple of days. Any help would be much appreciated!

edit retag flag offensive close merge delete

Comments

Nova provides the key via metadata. Perhaps this fails. Check this: Can you use the metadata API (curl http://169.254.169.254) on the instance? Does the instance have a way to access metadata when booting - cloud-config or equivalent?

Bernd Bausch gravatar imageBernd Bausch ( 2016-11-06 18:56:15 -0600 )edit