SSH Remote forward with ssh config file not Listening to all Addresses (Listening to local host only)

sshssh-tunnel

I'm trying to setup a Remote Forward from my AMAZON instance to my local machine (dev)
My problem is that when I connect to amazon server and when I run the netstat -antp command it shows me that I have a socket listening on the 127.0.0.1:8080 only however I want it to listen to the public interface.

Output of my "netstat -antp | grep LISTEN":

[centos@ip-##-##-##-## ~]$ netstat -ant
Proto Recv-Q Send-Q Local Address           Foreign Address         State           PID/Program name    
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      -       

I tried the RemoteForward option with :

[PUBLIC_IP]:8080 
[AMAZON_INTERNAL_IP]:8080
0.0.0.0:8080

This is the content of my .ssh/config file:

Host amazon
    User centos
    HostName ###.###.###.###
    RemoteForward  8080 127.0.0.1:81
    IdentityFile ~/.key.pem

Thanks for your help !

Best Answer

You need to write public IP address in your RemoveForward option:

RemoteForward  8080 ###.###.###.###:81

also you need to specify GatewayPorts yes in the server configuration and restart sshd service.