HPC/Network Access/Virtual Desktop
Principle of operation
VNC is a multi-platform graphical remote access mechanism. It is not as common as the X Window System but is more light-weight on the user side and over the network. If you find that remote use over X11 is too slow, try VNC. It operates as follows:
- Start a VNC server on a Carbon login node. This is an application process that will run under your user ID in the background and provide a virtual desktop for you.
- Modify your SSH connection to forward an appropriate port.
- Run a VNC client on your desktop machine and tell it to connect to the forwarded port. This will show the virtual desktop as a window on your actual desktop.
- You can stop your VNC client and reconnect later.
- When done, kill the VNC server process on Carbon.
Operating a virtual desktop session
Start the virtual desktop server
- Log in to Carbon using ssh as documented.
- On the Carbon prompt (showing either login5 or login6 as host name), enter:
vncserver
- At the first time, you will be asked for a password which will limit access to your virtual desktop session.
- Choose and remember a password of good strength, but not your login password.
- The VNC password mechanism is weak; think of it as an office door to shut, keeping out unwanted guests.
- To reset your VNC password at any time, run:
vncpasswd
- Take note of the display number from the output of the vncserver command:
New 'login5:1 (stern)' desktop is login5:1 Starting applications specified in /home/stern/.vnc/xstartup Log file is /home/stern/.vnc/login5:1.log
- The display number is shown after the
:
in the virtual desktop address, the last word on the first line. Display numbers by default are chosen automatically.
Forward the virtual desktop's port
Forward a (TCP) port from your machine to the same port on the Carbon login node. How to do that depends on the SSH program you use, and which port to forward depends on the display number.
- For Linux and Mac
- Press
<Enter> ~ C
(three keys in succession: enter, tilde, capital C). You should get a prompt like this:
ssh>
- At the prompt, enter:
-L port:localhost:port
- where
port
= 5900 + display number (from above), for example:
ssh> -L 5901:localhost:5901 Forwarding port.
- Press
<Enter>
to regain your regular prompt.
- For PuTTY on Windows
- TODO
Connect to the virtual desktop
- On a Mac
- Select Connect to Server… from the Finder's menu, or press Command + K.
- Enter the Server Address in the form
vnc://localhost:displaynum/
and push Connect. - You will get a warning that the connection is insecure. This warning pertains only to an internal connection between your SSH-forwarded port and vncserver. Your main remote connection from your own desktop to clogin will continue to be encrypted over the SSH channel.
- Enter the VNC password you chose earlier.
- You wil obtain a fairly basic virtual desktop with an xterm window running. The desktop is deliberately kept simple to reduce overhead and startup times.
Note: The screen shots were taken from a Mac running OS X version 10.8.2; Screen Sharing under other OS X versions will look and behave slightly differently.
Teardown the virtual desktop
On a Carbon login node where you started the VNC server, enter:
vncserver -kill :displaynum
Tips
Please practice good housekeeping and do not needlessly leave vncserver processes running. Stale vncserver processes (those that have not been used for days) will be killed.
Customizing the virtual desktop
- Override the size and color depth of the virtual desktop by supplying options to
vncserver
:
vncserver -geometry 1920x1080 -depth 24
- These options will raise your network bandwidth requirements. For more, see
man vncserver
Screen Sharing on the Mac
- Recent Screen Sharing versions will pass through almost all keyboard input, which effectively disables many regular OS X keyboard shortcuts, in particular those for switching applications and taking screen shots.
- To switch to another application, click on its Dock icon.
- To take a screen shot, select Save Screen Capture As… from the Connection menu of the Screen Sharing application menu.
- To take screen shots more easily and use various other control options, choose Show Toolbar from the View menu of the Screen Sharing application menu.
Troubleshooting
- To see a list of recent VNC servers that you might be running:
ls -ltr ~/.vnc/*.pid
- Identify and inspect server log files:
ls -ltr ~/.vnc/*.log cat ~/.vnc/$HOSTNAME:displaynum.log
- You can simply and unceremoniously kill all vncservers on a given host by using the Unix kill command. For good measure, run it twice, then clean up:
kill `cat ~/.vnc/$HOSTNAME*.pid` kill `cat ~/.vnc/$HOSTNAME*.pid` rm ~/.vnc/$HOSTNAME*.pid