0

Connection refused" errors when trying to connect to my EC2 instance with SSH.

I am receiving Connection refused errors when trying to connect to my EC2 instance with SSH. How do I resolve this?

Amazon-ec2 Add a comment
michael
asked Oct 31 2021

Answer

0

Use AWS Systems Manager Session Manager

  1. Open the AWS Systems Manager console.
  2. Start a session.
  3. To disable firewalls and restart the SSH service, run the following commands.
    sudo iptables -F
    sudo service sshd restart

  4. Verify that the SSH tcp port (22) is in a listening state.

    sudo netstat -tnlp | grep :22
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      849/sshd
    tcp6       0      0 :::22                   :::*                    LISTEN      849/sshd
    
  5. Terminate the session.
  6. Connect to the instance using SSH.
Add a comment
linuxhelp
asked Oct 31 2021
Post your Answer