RDP a Windows Box from over a SSH tunnel to a Linux box

3

2

So here's my situation:

[OSX] ---vpn-ssh---> [ubuntu server] ---rdp---> [windows box] 

I have a laptop (OSX) and I can currently ssh over VPN (hamachi) into a headless ubuntu server running at a remote site. This ubuntu server serves a bunch of windows boxes that sit on the same LAN. What I really would like to be able to do is connect over RDP to the individual windows boxes from my laptop using the vpn-ssh connection I have.

I'm pretty sure this is a straightforward problem but I'm not really sure where to begin.

Everything is setup using standard ports. For reference, pretend:

Ubuntu Server

VPN: 25.25.25.25
LAN: 192.168.1.115

Some Win Box

LAN: 192.168.1.120

currently to connect to the server remotely, all I have to do is:

ssh root@25.25.25.25 

Thanks in advance,
Max

Max Rahm

Posted 2014-01-31T23:50:00.013

Reputation: 155

Have a look at this similar question: http://serverfault.com/questions/214816/remote-desktop-over-ssh-socks-proxy-to-bypass-firewall

– Benoit Duffez – 2014-11-21T08:36:01.620

Answers

2

You should be able to do something like:

ssh -L 2345:192.168.1.120:3389 -g root@25.25.25.25 

Ignoring the fact you shouldn't be running around as root, this creates a tunnel from local port 2345 to 192.168.1.120 port 3389. The -g allows remote hosts to connect to the forwarded port. The 2345 can be any available port number. Note the -g is not needed if you're just going to be doing this locally, but if you had another machine that you wanted to use (i.e. a client that connects to the Mac, that would then get to the Windows machine.

Once you've got the ssh session running, on the Mac, just connect to localhost:2345 with your RDP client, and via the magic of port forwarding, you should get connected to the Windows system.

ernie

Posted 2014-01-31T23:50:00.013

Reputation: 5 938

Yeah root was just an example ;) It works like a charm. Thanks for the quick response! – Max Rahm – 2014-02-01T00:08:08.880

0

This here is a neat question. However it seems to be a duplicate of a question on another Stack Exchange site.

Take a look at: Remote Desktop over SSH SOCKS Proxy

The answer is the one below the accepted answer about ssh port forwarding.

Good luck!

EDIT: earnie me to it.

steve

Posted 2014-01-31T23:50:00.013

Reputation: 612