I know how to use ssh to port forward a local port say like 7000 to a remote ssh server on port 50070. For example:

ssh -L 7000:127.0.01:50070 root@sshserver

"Me port 7000" - > "ssherver port 50070"

But now say I have my "sshserver" at the office and I want to port forward my local port via the "sshserver" to the windows machine that has terminal services running on port 3389. To clarify the windows machine does not have sshd running.

"Me port 7000" - > "sshserver" - > "windows machine port 3389"

Is this possible with ssh?

  • 1
    Not entirely sure what you are asking, but the ssh port forwarding is just a generic TCP forwarder. Any TCP connection can be established over the forwarded link, not just ssh. As long as the Windows machine port 3389 is a TCP service the forward should work.
    – jw013
    Apr 17, 2014 at 17:37
  • How do I make the tcp connection to the windows server?
    – sudo
    Apr 17, 2014 at 17:43
  • By connecting to your local port 7000.
    – jw013
    Apr 17, 2014 at 17:48

1 Answer 1


Local port forwarding means forwarding a port on the SSH client machine through the SSH server machine, not onto it. The IP address you specify in the argument is any address/hostname reachable from you SSH server. Thus if the Wintendo box is behind the server you are able to SSH into, and reachable from it, you simply can do this on your client:

$ ssh -L 7000:<IP of Windows box>:3389 <SSH server>

Then you can connect to your client's port 7000 and the connection is forwarded through your SSH server to the Windows box's port 3389.

  • I thought that I usually put / localhost was just for the interface to listen on now I learned it can really be anything. Thank you!
    – sudo
    Apr 17, 2014 at 18:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .