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

Related: Windows to Windows SSH / RDP


Assumes Linux laptop to connect to a remote PC such as: * Windows PC with SSH server * Linux PC with XRDP

Install

apt install freerdp2-x11

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

Example

Remote PC IPRemote PC SSH portRemote PC RDP port
1.2.3.422 (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 remoteusername@1.2.3.4 sleep 1;

   xfreerdp /v:localhost:4389
   
  1. make executable
   chmod +x rdpmypc.sh
   
  1. 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.