0

When I try to connect to ec2 through my pem file it worked fine. Once I connected to ec2 and exited from terminal, from next time it's giving error

ssh_exchange_identification: Connection closed by remote host

When I again tried to connect, I got the following error

ssh_exchange_identification: read: Connection reset by peer

I have rebooted the instance and now I am getting the following error

ssh: connect to host MY-IP port 22: Operation timed out

I have seen so many solutions. Most of them messed up with security groups. But I have correct security group.

INBOUND ssh 22 0.0.0.0/0

OUTBOUND All Trafic All All 0.0.0.0/0

Even then I am getting the same error.

I have tried ssh -v -i XXX.pem [email protected]

ouput is

OpenSSH_7.6p1, LibreSSL 2.6.2 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: /etc/ssh/ssh_config line 52: Applying options for * debug1: Connecting to my_ip port 22. ssh: connect to host my_ip port 22: Operation timed out

5
  • 1
    It sounds to me like the SSH server on the remote host is experiencing issues of some kind. I've seen various issues cause the SSH daemon to simply stop accepting connections, or unexpectedly close open ones. Best course of action is to launch a recovery instance, attach the faulty instance's EBS volume to your recovery instance, and inspect the logs.
    – dannosaur
    Dec 24, 2018 at 8:56
  • 1. You should post the full debug error (and use editor to mask out the ip and server name) and format it in code sample. 2. Open your AWs console and look for the ssh connection command, e.g. try ssh -i xx.pem [email protected].
    – mootmoot
    Dec 24, 2018 at 9:09
  • Is your instance running? And does it have the same IP address? Dec 24, 2018 at 15:07
  • yes. I have checked all those basic things. Dec 25, 2018 at 4:15
  • I experienced the same issue (I believe) last night. My question is here serverfault.com/questions/947600/… Jan 4, 2019 at 22:23

0

You must log in to answer this question.

Browse other questions tagged .