Unable to SSH to EC2

Asked 2 years ago, Updated 2 years ago, 88 views

I created VPC, security group, EC2 in AWS.
I assigned a subnet and tried to connect to SSH at my terminal, but I can't connect to SSH.

execution commands:

>ssh-ixxx.pemec2-user@Elasticip address

The error results are as follows:

ec2-user@Elasticip address: Permission denied (publickey, gssapi-keyex, gssapi-with-mic).

The pem key exists in my download folder and the permissions are as follows

-rw ------- @xxx.pem

Also, the results of running ssh-vvv to learn more about the error are as follows:

penSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data/Users/xxx/.ssh/config
debug1: Reading configuration data/etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line47: Applying options for *
debug1: Connecting to 1qaz2wsx.pemport22.
ssh: Could not resolve hostname xxx.pem: nodename nor servname provided, or not known

I don't think the name has been resolved, but I don't know exactly where to fix it.
Could someone tell me?

linux ssh amazon-ec2

2022-09-30 20:23

1 Answers

Try restarting sshd by editing Elastic /etc/ssh/sshd_config.

HostKey/etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
PubkeyAuthentication yes


2022-09-30 20:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.