Skip to content

Instantly share code, notes, and snippets.

@pangyuteng
Last active July 20, 2023 22:31
Show Gist options
  • Save pangyuteng/5361cd4fbc3ae6f9c7a824e0bc72a332 to your computer and use it in GitHub Desktop.
Save pangyuteng/5361cd4fbc3ae6f9c7a824e0bc72a332 to your computer and use it in GitHub Desktop.
rdp with reverse tunnel

rdp with reverse tunnel

TARGET (within VPN) -- INTERMEDIATE -- LAPTOP

If you want to connect to TARGET and are not able to setup vpn from LAPTOP to TARGET. You can try RDP with the below setup via an intermediate server (in the cloud, or local server at home).

  • run below in TARGET:

ssh -R $custom_port:127.0.0.1:3389 INTERMEDIATE or ssh -f -N -T -R $custom_port:localhost:3389 INTERMEDIATE

  • run below in LAPTOP:

ssh -L 3389:127.0.0.1:$custom_port INTERMEDIATE

  • access TARGET via rdp with below in LAPTOP:

localhost:3389

viola!

reference

https://gist.github.com/edrex/a1c1325ff469b2ad5c13

https://superuser.com/questions/352268/can-i-make-ssh-fail-when-a-port-forwarding-fails

https://unix.stackexchange.com/questions/46235/how-does-reverse-ssh-tunneling-work

@pangyuteng
Copy link
Author

my INTERMEDIATE does not need special configuration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment