How to allow remote connections from non localhost clients with ssh remote port forwarding?

I have a system say "privatesys". I am trying to give access to its web server through a remote proxy using ssh remote port forwarding like below.

Private sys name: privatesys
Port exposed: 80

The remote system name: remotesys
The remote port: 9090

On privatesys, I ran the following command.

ssh -N -R remotesys:9090:localhost:80 -l username remotesys

It set up a tunnel between privatesys and remotesys and the port forwarding worked fine as long as I connect to port 9090 from remotesys.

What I like to do is access http://remotesys:9090/ from systems that are on the same sub net as remotesys. When I do that, I am getting invalid url error from browser. Looks like the sshd on remotesys is bound to localhost instead of all the interfaces on the system.

What is the trick to get sshd on remotesys accept connections from any system on its sub net?


Solution 1:

You might need to change the servers config. Set GatewayPorts to 'on' or 'clientspecified'. Otherwise the remote interface is restricted to localhost