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

7,627

You should be able to do something like:

ssh -L 2345:192.168.1.120:3389 -g [email protected] 

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.

Share:
7,627

Related videos on Youtube

Max Rahm
Author by

Max Rahm

Updated on September 18, 2022

Comments

  • Max Rahm
    Max Rahm over 1 year

    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 [email protected] 
    

    Thanks in advance,
    Max

  • Max Rahm
    Max Rahm over 10 years
    Yeah root was just an example ;) It works like a charm. Thanks for the quick response!