I am unable to login to the EC2 server.

Here's the log of the connection-attempt:

$ ssh -v -i ec2-key-incoleg-x002.pem ubuntu@ec2-50-16-0-207.compute-1.amazonaws.com
OpenSSH_5.6p1, OpenSSL 0.9.8p 16 Nov 2010
debug1: Reading configuration data /home/gvaish/.ssh/config
debug1: Applying options for *
debug1: Connecting to ec2-50-16-0-207.compute-1.amazonaws.com [50.16.0.207] port 22.
debug1: Connection established.
debug1: identity file ec2-key-incoleg-x002.pem type -1
debug1: identity file ec2-key-incoleg-x002.pem-cert type -1
debug1: identity file /home/gvaish/.ssh/id_rsa type -1
debug1: identity file /home/gvaish/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-50-16-0-207.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/gvaish/.ssh/known_hosts:8
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: ec2-key-incoleg-x002.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/gvaish/.ssh/id_rsa
debug1: No more authentication methods to try.
Permission denied (publickey).

What can be the possible reason? How do I fix the issue?

link|improve this question
I think i've found the problem... it's the username problem. What's the default user created for the AMI ami-74f0061d (It's Amazon AMI) that I'm using for a test micro instance. – MasterGaurav Mar 3 '11 at 16:58
Got it. It's ec2-user – MasterGaurav Mar 3 '11 at 17:18
feedback

migrated from stackoverflow.com Mar 3 '11 at 3:24

This question came from our site for professional and enthusiast programmers.

1 Answer

It looks like you're using the wrong public key. Are you sure you have the right public key or that your private key on the server accepts the public key you're using?

link|improve this answer
I don't have public key under control. It's a new key that I've created on Amazon EC2. How do I associate a public/private key with an AMI instance that I've launched? – MasterGaurav Mar 3 '11 at 16:26
1  
Once an instance is launched you cannot associate a new key. – Flashman Apr 5 '11 at 20:30
feedback

Your Answer

 
or
required, but never shown

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