VNC via SSH tunneling

 Comments

5 simple steps to connect through VNC to office/work PC via SSH tunneling

Situation:

You have to connect to your office PC from home via VNC, but your office PC does not have a public IP. The only way to access your PC is through one of the access point machines provided by your office that can be reached through Internet.

Concept:

VNC port is 5900. You can ssh tunnel to your office PC through your office access point, and connect to this tunnel to have VNC connection.

Assumption:

Office access point machine: accesspts1.company.com
Internal IP of your office machine: 192.168.1.31

Also assume that your Office PC is switched on, and access point machine can access your office PC via the internal IP, and can access its ports as well.

Steps:

  1. SSH to access point machine. Provide password when prompted
    ssh [email protected]
  2. Now that you are on access point machine, ssh from there to your office PC. Again provide password when prompted.
    ssh [email protected]
  3. On your office pc, start VNC server. Keep this terminal open.
    x11vnc
  4. On another terminal, make open a tunnel to your office pc via the access point. Provide the password for your access point machine when prompted.
    ssh -L 0.0.0.0:xxxx:192.168.1.31:5900 [email protected]
  5. Use an VNC viewer to connect to your Office PC via the tunnel. Use the following details:
    Host: localhost
    Port: xxxx

LINUX TIPS
blog comments powered by Disqus