Cannot connect to EC2 instance from the beginning

0

Here is the SSH connection diagnose output:

C:\Users\YYY>ssh -v -i WebKey.pem ec2-user@ec2-3-80-22-124.compute-1.amazonaws.com OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2 debug1: Connecting to ec2-3-80-22-124.compute-1.amazonaws.com [3.80.22.124] port 22. debug1: Connection established. debug1: identity file WebKey.pem type -1 debug1: identity file WebKey.pem-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Debian-5+deb11u2 debug1: match: OpenSSH_8.4p1 Debian-5+deb11u2 pat OpenSSH* compat 0x04000000 debug1: Authenticating to ec2-3-80-22-124.compute-1.amazonaws.com:22 as 'ec2-user' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:8FWlqWo+yY5LyO0BCVYst0sUSfth8/49KEZSwvN1RWg debug1: read_passphrase: can't open /dev/tty: No such file or directory The authenticity of host 'ec2-3-80-22-124.compute-1.amazonaws.com (3.80.22.124)' can't be established. ECDSA key fingerprint is SHA256:8FWlqWo+yY5LyO0BCVYst0sUSfth8/49KEZSwvN1RWg. Are you sure you want to continue connecting (yes/no/[fingerprint])? no Host key verification failed.

This output shows it is a problem from the instance side, cannot fix it without login. Anybody had the same issue before? Thanks.

XM
asked 6 months ago197 views
3 Answers
1

Are you sure you want to continue connecting (yes/no/[fingerprint])?

From the output above it loks like you replied no to this, and so the connection terminates.

What happens when you answer yes?

profile picture
EXPERT
Steve_M
answered 6 months ago
0

Which version of Linux is installed on the EC2?

This hints at it being Debian OpenSSH_8.4p1 Debian-5+deb11u2 and the default user for Debian is admin not ec2-user https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html#ami-default-user-names

profile picture
EXPERT
Steve_M
answered 6 months ago
  • I tried all the different user names (admin, ec2-user, ec2_user, root, ubuntu ....). I think the issue is at the server side. Don't know if this matters: read_passphrase: can't open /dev/tty: No such file or directory

0

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'ec2-3-80-22-124.compute-1.amazonaws.com,3.80.22.124' (ECDSA) to the list of known hosts. debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 134217728 blocks debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory debug1: Will attempt key: WebKey.pem explicit debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: WebKey.pem debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. ec2-user@ec2-3-80-22-124.compute-1.amazonaws.com: Permission denied (publickey).

XM
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions