My SSH session to AWS Ubuntu Server Hangs

Ardipithecus [he/him]@hexbear.net to Linux@lemmy.ml – 7 points –

Hi Friends,

I have an Ubuntu 22.04.3 server out in AWS that I can connect via Bitvise with no problems. However, when running any kind of command (ls, cat) the session hangs and restarts. The command goes through since when i reconnect, whatever task I put through is finished (I installed RT5) but now I can't edit files or anything.

Things I've tried: Made sure ICMP is enabled throughout my network and Security Group.; Also lowered the MTU on the server (default was 9001 and it's now 1422).

Here is a wireshark capture of when the DC occurs. Any thoughts on what this is? Any way to test where this breaks down?

I appreciate any help, thank you!

5

Have you looked into AWS Cloudwatch logs? That's usually the best bet to see what's happening on the cloud side of things.

I set up a log group for that instance and it showed nothing.

I don't know if I set it up wrong or if just means things are fine on that side.

A few suggestions:

  • One of the most common causes for SSH sessions hanging is a security group assigned to the instance has an incoming IP address whitelist. If the IP address you are connecting from doesn't match, it won't let you connect and silently hangs. Easiest way is to whitelist every IP address range but that's not good practice.

More here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html

  • It can also happen if the Security Group doesn't allow access via standard port 22. In that case, you need to explicitly set your port when connecting.

  • Finally, if you've set up 'password free' SSH, make sure the keypair is valid and you haven't messed up file access privs.

More here: https://aws.plainenglish.io/4-steps-to-connect-aws-servers-using-ssh-without-key-pairs-17c64853918c

Suggest you try a process of elimination. Use the console SSH client to verify connection. See if that works. Then try the above steps to narrow it down on the client side.

HTH.