Skip to content

Instantly share code, notes, and snippets.

@saivert
Last active November 24, 2016 20:55
Show Gist options
  • Save saivert/4d82439f33423853a06289d9bf5ef979 to your computer and use it in GitHub Desktop.
Save saivert/4d82439f33423853a06289d9bf5ef979 to your computer and use it in GitHub Desktop.
RDP tunneled over SSH on bash on windows
REM Fire up bash on windows to run our ssh client with port forwarding and a master control socket
REM using /b to background the task
start /b bash.exe -c "ssh -N -L127.0.0.1:3390:10.0.0.8:3389 -M -S ~/.rdp-ssh.socket user@example.com"
REM start RDP client and wait for it to close
start /wait mstsc.exe /v:127.0.0.1:3390
REM send stop signal to our ssh client
bash.exe -c "ssh -O stop -S ~/.rdp-ssh.socket user@example.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment