I'm trying to allow ssh access from a remote RHEL server to a local RHEL box via Win/Putty gateway. Basically, I'd like to be able to do 'ssh localhost -p 512' on a remote server so that it would connect to the RHEL server in the local network. The local network is beyond a firewall so I can connect from my Win PC to the remote server with Putty/ssh but not vice verse.


So, I've added the following tunneling settings to the current RmtSrv session in Putty (actually I use Kitty but doesn't matter):

R512 LclSrv:22

I expect that this would create a process on the remote server that listens port 512 and transfers the connections to a local network/LclSrv port 22.

After pressing start button, Putty opens a regular ssh terminal session successfully but nothing happens. (options show active port forwarding). I've checked with netstat -l that port 512 is not listening on RmtSrv. ssh on this port returns 'connection refused'. What am I doing wrong? May be there is something in the sshd_config that needs to be changed in order to allow the tunneling? Could it be user privileges on RmtSrv that prevents me from creating tunnels? I have sudo btw.

Cheers, Vlad.

  • Should this be in SuperUser instead?
    – Envite
    Dec 3 '13 at 6:44

Local port forwarding scenario (rmtsrv has access to WinXP):

What you want to do in ssh terms is forward a local port to another machine and allow other hosts (rmtsrv) to connect to it.

So you set up local WinXP:512 to forward to lclsrv:22.

So in Putty's Tunnel settings be sure to check Local ports accept connections from other hosts and add source port 512 with the destination lclsrv:22 to the forwarded ports.

Edit to accommodate comment: Remote port forwarding scenario (WinXP has access to both srvs):

The configuration you suggest should work.

r512 LclSrv:22

Is correct. I'd guess the issue is with the sshd security settings on rmtsrv. Check if this is enabled:

AllowTcpForwarding yes

If you want to enable access to the forwarded port for others on rmtsrvs network:

GatewayPorts yes

The config usually resides in '/etc/ssh/sshd_config

  • This will not work because RmtSrv cannot establish connecting with the WinXP machine due to the firewall settings. The opposite is possible however.
    – spoonboy
    Dec 3 '13 at 7:40
  • Yeah, I misunderstood your question, so I extended the answer.
    – AndreasT
    Dec 3 '13 at 8:06
  • Yes, thanks, "AllowTcpForwarding yes" solved the issue.
    – spoonboy
    Dec 3 '13 at 22:57
  • Happy to help. Not to bug you, but could you set the answer to accepted then?
    – AndreasT
    Dec 4 '13 at 12:19

On the left side of the Putty window you have a Menu. On it, SSH has a + to its left. Click there. Go to Tunnels. Configure them. Voilà.

  • Yes, I've done this but it doesn't work. It works however on my home Ubuntu, so I assume that it has something to do with the authority or sshd configuration in RHEL.
    – spoonboy
    Dec 3 '13 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.