Skip to content

SSH hangs immediately after TCP connection on Ubuntu 24.04 t2.micro instance

0

I have an Ubuntu 24.04.2 LTS t2.micro EC2 instance in eu-west-2. Both EC2 status checks are green and I can reach port 22 with netcat, but any SSH session simply hangs after “Connection established” and no SSH banner ever appears, despite being able to SSH a matter of mere minutes ago. No changes were made on our AWS console. This same behaviour is reported across all members of my team who try to SSH into our EC2 instance.

What I’ve tried so far • DNS & TCP • dig +short api.COMPANY.com returns the correct Elastic IP. • nc -vz api.COMPANY.com 22 succeeds • ssh -vvv -i ~/.ssh/server-key.pem ubuntu @api.COMPANY.com stalls after “identity file … type -1”. • System log shows “Started OpenBSD Secure Shell server”. • /etc/ssh/sshd_config contains Port 22 and no ListenAddress overrides.

It feels as though sshd isn’t actually responding on the IPv4 socket despite appearing to run. How can I diagnose why no banner is sent and restore normal SSH access? Any advice would be greatly appreciated.

2 Answers
0

SSH hanging can be due to:

System out of memory
CPU at 100%
Disk full

answered a year ago

0

You are using a micro instance which is very small. Check Cloudwatch metrics if the EC2 is running low on CPU. If so, upgrade the instance type to small or medium and retry.

EXPERT

answered a year 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.