VNC Through SSH-Tunnel (SSH Port Forwarding)
Follow the following steps to setup remote desktop session through SSH tunnel:
SSH/Telnet to the Unix Server you want to run desktop session on. Currently, SSH Tunneling is only allowed on venus.ccse.kfupm.edu.sa
Enter the Unix machine's name in the Host Name field (i.e., venus.ccse.kfupm.edu.sa) and select SSH as the Protocol, as shown in the above screen. Now click on Open button. You will get the following terminal:
Enter your CCSE Unix username and password to login to the Unix machine. If you login successfully, you will get the command prompt as shown in the picture below. After that, start the VNC server by typing in “ vncserver” on the command line as shown below:
For example, in the above given picture, note the display number, it is “2” (taken from the desktop address “sunfire9:2”. Similarly, incase the desktop address you get is “sunfire9:7”, then the display number will be “7”).
Note: If you are starting the VNC server for the first time, it will ask you to set a password. Set the password to something of your choice. You will have to use that password to connect to the VNC server from the VNC viewer. (for more info about VNC, visit the following link: http://www.kfupm.edu.sa/colleges/ccse/SitePages/en/vnc.aspx )
You need to perform this step only once, until you kill the VNC server that you started. After finishing your work you must kill the VNC server by doing SSH to the Unix machine where you started the VNC server (sunfire1.ccse.kfupm.edu.sa in this case) and running the following command:
vncserver –kill :1
Where "1" is your display number. If the display number is 7, then use that in the above command (for example, vncserver –kill :7 ).
On your client machine, launch PUTTY. You will get the PUTTY configuration screen as shown below. Enter the Unix hostname on which you have started the vncserver in Step 1 and set the port to 22. In this case it is venus.ccse.kfupm.edu.sa .
Go to Connection -> SSH -> X11 in the left menu of PUTTY configuration window as shown below. In "X display location" field, enter the value "localhost:0".
Go to Connection -> SSH -> Tunnels in the left menu of PUTTY configuration window as shown below. In Source Port field, enter the port number. This port number should be 5900 plus the display number of VNC. In this case, it is 5902, as the display number is 2 (see Step 1). In Destination field, enter server_name:port_number . Where server_name is the name of Unix host running VNC server, which is venus.ccse.kfupm.edu.sa, and port_number is the 5900 plus the display number of VNC (i.e., 5900 + 2), which in this case is 5902. Now click on Add button. Finally, click Open and login using your Unix user id and password.
Start VNC viewer and enter localhost:display_number in VNC Server field. Where display number is the number of VNC display, which you got in Step 1. In our case, it is 7. So we will enter localhost:7 . Click OK and provide your VNC session password.