VNC via proxy

Connect from local Linux machine via a gateway proxy to remote Windows machine
How I do remote helpdesk support to family members...
  • On Windows machine install a VNC server. TightVNC
  • Create proxy, e.g. launch an Ubuntu instance on AWS EC2. Ensure it has a public IP.
    Add security group with policies:
    • Port 22 open to 0.0.0.0/0
    • Port range 5500-5599 open to 0.0.0.0/0
    • Port range 5800-5999 open to 0.0.0.0/0
  • One Linux machine SSH to EC2 proxy server ssh -i ~/.ssh/mysshkey ubuntu@IP.OF.EC2.SERVER
  • On EC2 proxy server
    • Edit ssh config on EC2 proxy server sudo vi /etc/ssh/sshd_config
    • Enable public ssh tunnel ports on EC2 proxy server by enabling GatewayPorts at the end of sshd config file GatewayPorts yes
    • Restart ssh service on EC2 proxy server sudo service sshd restart
  • On Linux machine
    • install VNC client. sudo apt-get install xtightvncviewer
    • Open remote SSH tunnel from Linux machine to EC2 based proxy server. ssh -N -T -v -i ~/.ssh/mysshkey -R 5500:0.0.0.0:5500 ubuntu@IP.OF.EC2.SERVER
    • In another terminal launch VNC viewer in listening mode xtightvncviewer -listen
  • On Windows machine:
    • Start VNC service (it may have already started).
    • Right click on VNC icon in bottom tray.
    • Choose "Attach Listening Viewer..."
    • Enter IP of EC2 proxy server.
  • Once finished, on Windows machine you might want to shutdown TightVNC and even uninstall it so that it is not accidentally switched on later, and left exposed.
  • Remember to shut down EC2 server, and terminiate it to avoid uneccesary charges.