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

less than 1 minute read

Related: Windows to Windows SSH / RDP


Assumes Linux laptop to connect to a remote PC such as:

Install

apt install freerdp2-x11

If this has connection issues, you can fall back to using freerdp-x11.

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

  • Advanced freerdp configuration (e.g. limited bandwidth)
  • xfreerdp command line options
  • Try freerdp-x11 if freerdp2-x11 errors upon first mouse click after connecting with:
    [ERROR][com.freerdp.core] - freerdp_check_fds() failed - 0
    [INFO][com.freerdp.client.x11] - Network disconnect!
    [ERROR][com.freerdp.client.x11] - Failed to check FreeRDP file descriptor
    
    [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
    
  • freerdp2-wayland on Wayland didn’t work for me.

Tags:

Categories:

Updated:

Leave a Comment