0

I'm trying to ssh into my ec2 instance in order to deploy my MEAN-stack app but no matter what I'm receiving a timeout error. I've tried so many solutions that were posted in other StackExchange threads but to no avail. I am running macOS 10.14.1

On my mac I've tried connecting via FileZilla, Cyberduck and even using command line arguments such as ssh -v -v -v -i "<pem-file-name>.pem" [email protected] and ssh [email protected]. Below is the error output from running either of these commands:

OpenSSH_7.1p2, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to ec2-18-207-106-113.compute-1.amazonaws.com [18.207.106.113] port 22.
debug1: connect to address 18.207.106.113 port 22: Connection timed out
ssh: connect to host ec2-18-207-106-113.compute-1.amazonaws.com port 22: Connection timed out

These are the solutions that I've tried that did not seem to work:

  • Connecting on Windows 10 using PuTTY, FileZilla and command line, but also received the same timeout errors.

  • Using a different MSI (first with Bitnami, then with Ubuntu)

  • Firewall is disabled

  • Resetting the default port in /etc/ssh/ssh_config and connecting to the new port

  • Pinging ec2-18-207-106-113.compute-1.amazonaws.com and 18.207.106.113 is successful

  • Running command netstat -nat | grep 22 gives the below output

    tcp4       0      0  192.168.254.17.56207   17.249.188.80.5223     ESTABLISHED
    9e4be63389882253 stream      0      0                0 9e4be6338988231b                0                0
    9e4be6338988231b stream      0      0                0 9e4be63389882253                0                0
    9e4be63384ea2193 dgram       0      0                0 9e4be63384ea225b 9e4be63384ea225b                0
    9e4be63384ea225b dgram       0      0                0 9e4be63384ea2193 9e4be63384ea2193                0
    kctl       0      0     22      9 com.apple.netsrc
    
  • The EC2 security group has the following inbound rules set up: EC2 Security Group

1 Answer 1

0

Welcome to SuperUser @Robert!

All of your clues initially seemed to point to an issue with the Security Group attached to the instance, but your SG rules look fine.

There's a tool called hping that you can get on your Mac (via brew) that you can use to 'ping' port 22 on your 18.207.106.113 server. I tried it and it works:

$ sudo hping -S -p 22 18.207.106.113
HPING 18.207.106.113 (en0 18.207.106.113): S set, 40 headers + 0 data bytes
len=44 ip=18.207.106.113 ttl=42 DF id=0 sport=22 flags=SA seq=0 win=26883 rtt=38.8 ms
len=44 ip=18.207.106.113 ttl=44 DF id=0 sport=22 flags=SA seq=1 win=26883 rtt=39.6 ms
len=44 ip=18.207.106.113 ttl=42 DF id=0 sport=22 flags=SA seq=2 win=26883 rtt=40.7 ms

Now the clues are pointing to an issue on the local side, either your Mac and/or your network. For starters, reset your Mac's /etc/ssh/ssh_config to its default, because you didn't change the SSH port the server is listening on.

If that doesn't work, try putting your Mac onto a different network, perhaps turn on your phone's hotspot and connect to that or go to a friend's house or to a coffee shop.

And if that fails, use a different machine altogether. That should (hopefully) work, then you can work your way back to tracking down what was causing the problem in your equipment.

Good luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .