Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I'm trying to connect to my EC2 instance with SSH and I am getting crazy.

It's still not working for me. Any idea what am I missing?

helo@ubuntu:~/keys$ ssh -v -i ec2-key-pair.pem [email protected]

OpenSSH_6.6, 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 ec2-54-72-242-0.eu-west-1.compute.amazonaws.com [54.72.242.0] port 22.

debug1: Connection established.

debug1: identity file ec2-key-pair.pem type -1

debug1: identity file ec2-key-pair.pem-cert type -1

debug1: Enabling compatibility mode for protocol 2.0

debug1: Local version string SSH-2.0-OpenSSH_6.6p1 Ubuntu-2ubuntu1

debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2

debug1: match: OpenSSH_6.2 pat OpenSSH* compat 0x04000000

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: server->client aes128-ctr [email protected] none

debug1: kex: client->server aes128-ctr [email protected] none

debug1: sending SSH2_MSG_KEX_ECDH_INIT

debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

debug1: Server host key: ECDSA e4:06:ee:a5:a5:d2:97:5f:0f:b7:06:5e:f2:b3:da:26

debug1: Host 'ec2-54-72-242-0.eu-west-1.compute.amazonaws.com' is known and matches the ECDSA host key.

debug1: Found key in /home/roberto/.ssh/known_hosts:3

debug1: ssh_ecdsa_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-pair.pem

debug1: key_parse_private2: missing begin marker

debug1: read PEM private key done: type RSA

debug1: Authentications that can continue: publickey

debug1: No more authentication methods to try.

Permission denied (publickey)

UPDATE:

1 Answer

0 votes
by (44.4k points)

Try these steps:

ssh-keygen -R 54.72.242.0

sudo chmod 600 yourkeypair.pem

and then:

ssh -i yourkeypair.pem [email protected]

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...