SSH port forwarding

Solution 1:

SSH remote port forwards will default binding to localhost/loopback for security purposes. It's not often preferable to allow other hosts access to your forwarded ports.

To override this behaviour you will need to do two things:

  • Enable the GatewayPorts option on the server.
  • Specify a bind address, or * to bind to all addresses, on the client.

    ssh -R \*:8000:localhost:22 user@public
    

Escape the asterisk to ensure that your shell doesn't expand it.