ssh -g -R port:localhost:port remotehost netstat -l on remotehost shows: tcp 0 0 localhost:port *:* LISTEN 22470/sshd: wavexx tcp6 0 0 ip6-localhost:port *:* LISTEN 22470/sshd: wavexx Using -g should use INADDR_ANY, not localhost.
Hello, got the same problem today and readed some manpages at first and used a little bit google also nerved some people on irc ;) man ssh
This should still be at least a wishlist to change the man page to clarify that -g only works for -L port forwarding. In the SSH docs, "port forwarding" is pretty much described the same for -L and -R forwarding, so the -g description in the manual should make clear that it is only for -L forwarding. Either that, or it should do as it says in the manual and allow remote hosts to connect to the forwarded port during a -R forwarded port.
(Sorry for two messages instead of one) The other issue is that with the solution above (change the sshd_config GatewayPorts setting) it is all or nothing. With the -g option combined with the -L option, you can choose to allow remote hosts to access some forwarded ports but not others. With the solution above, there is no way to do this except firewall rules.
+1 for thig bug. Fix, please, -g is very desirable option.
The problem does not occur if one uses GatewayPorts yes (server enforces bind to any interface) GatewayPorts no (server enforces bind to loopback device) If using 'clientspecified' on the server (server does what client says) and issuing (on the client:) ssh -g -R 1234:bla:234 blubb ssh should bind to all interfaces on blubb, as the docs say. But it only connects to the loopback device. But using ssh -g -R :1234:bla:234 blubb works as expected. When using -L instead of -R this problem does not occur. regards --lars
Are you using control sockets by any chance?