I've just started playing around with SSH tunnels today, but I'm stick at a bit of a silly point (I think)… Probably just missing something obvious but here goes:
I've got two linux servers and a single windows client (server1, server2, client). I've set up server1 to create a reverse ssh tunnel to server2, like so:
ssh -nNfR 8022:localhost:22 user@server1
After which I can successfully get a shell on on server1 using:
ssh -p 8022 localhost
Logically, this leads me to think that I should be able to create a putty ssh connection to server1:8022 and get a shell for server2, but I get a connection refused error. Anyone know what I'm missing or am I entirely on the wrong track 🙂
Thanks
Best Answer
This is a common problem. You need to enable port access on the server. Modify GatewayPorts to yes in /etc/ssh/sshd_config.
see man sshd_config under GatewayPorts.
You may also need to specify a bind address to your tunnel setup:
to bind to all interfaces.
see man ssh under -R