One-click SSH Tunnel with RDP (from Linux to a remote Windows PC)

Related: Windows to Windows SSH / RDP


Assume a remote Windows PC with SSH Cygwin Windows server or remote Linux PC with XRDP.

  1. install FreeRDP for X11 or Wayland
    apt install freerdp2-x11
    

    Alternative for Wayland users:

    apt install freerdp2-wayland
    
  2. Select between X11 FreeRDP and Wayland FreeRDP:
    xfreerdp
    

    or

    wlfreerdp
    

Note: I’ve found wlfreerdp included with Ubuntu 17.10 to crash when enabling /clipboard with errors including:

[ERROR][com.freerdp.channels.cliprdr.client] - cliprdr_order_recv failed with error 1359!

[ERROR][com.freerdp.core] - cliprdr_virtual_channel_client_thread reported an error. Error was 1359

xfreerdp /clipboard works fine for me.

Example

Remote PC IP Remote PC SSH port Remote PC RDP port
1.2.3.4 22 (open TCP firewall) 3389 (blocked by remote PC firewall)
  1. create script myrdp.sh on your laptop:
    #!/bin/sh
    
    ssh -f -L 4389:localhost:3389 [email protected] sleep 1;
    
    xfreerdp /v:localhost:4389
    
  2. make executable
    chmod +x rdpmypc.sh
    
  3. Setup SSH tunnel and connect to the RDP Windows desktop from Linux laptop:
    ./rdpmypc.sh
    

Notes

Tags:

Categories:

Updated:

Leave a Comment