Monday, October 17, 2016

VNC Viewer

I recently built a desktop for development in my company’s CORP network. By using VNC, I can access the same Gnome session even from home. Just simply connect to VPN, and start a vnc viewer, I can resume what I do at office.
I have a CentOS 6 on my development desktop. I installed RPM pacakages: vnc-server. (TODO: Details about setting up VNC server.)
I tried TigerVNC Viewer, but it was really bad, especially F8 menu key because I use Eclipse, F8 is used a lot when you are debugging. And there is not a pop-up menu bar like VirtualBox when you are in full-screen mode.
RealVNC satisfies all my requirements about VNC:
  • A menu bar
  • Better configuration UI on Windows 7
  • I can write a script to start VNC viewer
    through SSH tunnel make the viewer goes into full-screen mode on my secondary display automatically.
In CORP network, just click the VNC button on Windows’ taskbard, type the password, the viewer is in full-screen mode on my secondary display.
#/bin/bash
set -e

shutdown() {
  if [ -n "$tunnel_pid" ]; then
    kill $tunnel_pid
  fi
}

trap shutdown EXIT

ssh -N -L 5902:localhost:5902 mydev.desktop &
tunnel_pid=$!

~/apps/bin/VNC-Viewer-5.2.1-Windows-64bit.exe \
  --Monitor='\\.\Display2' \
  --FullScreen=1 \
  localhost:2
I also installed cygwin on Windows so that I could use OpenSSH. The script can clean up the SSH tunnel once the script quits.
At home, the network connection is slow. And that script will fail because RealVNC gets timeout. I didn’t find how to make RealVNC wait for a longer time. I just simply run SSH tunnel and viewer separately in different screens of GNU Screen in a Cygwin terminal.
I chose JPEG encode for better performance when I at home.

No comments:

Post a Comment