Using AWS EC2
Reverse SSH tunnel initiated from a remote machine to AWS:
/usr/bin/autossh -M 0 -N -R 19999:localhost:22 ec2-user@ec2.aws.com -v -i cloud.pem
Added port 19999 in AWS security groups.
Checked if I can connect with telnet to AWS:
telnet: Unable to connect to remote host: Connection refused
However, if I take away port 19999 in security groups I get a different response:
telnet: Unable to connect to remote host: Connection timed out
So I assume that problem is on the AWS host, and not with firewall on another machine.
Then I check if the sshd
tunnel has started on the AWS end, in response to my connection.
netstat
suggests that the service is listening:
tcp 0 0 127.0.0.1:19999
But still I get Connection refused messages. What else I can analyze? I couldn't find any sshd
logs on the AWS machine. /var/log/secure
doesn't log these failed connection attempts.