Table of Contents
Overview
VNC = Virtual Network Computing http://en.wikipedia.org/wiki/VNC enables you to set up a connection from a remote host (e.g. a PC offsite) to a session on a SLAC Linux host. For access to control system components such as edm displays or matlab programs, VNC often provides the best performance.
This document contains instructions for setting up a connection from a Windows PC to a VNC linux session.
Set up your PC (one time)
- Install vpn if you don't have it already. Instructions from SCCS are here: https://confluence.slac.stanford.edu/display/NetMan/How+to+Connect+to+SLAC+VPN
- Download and install the vnc for windows viewer client software executable from here: http://www.realvnc.com/products/free/4.1/winvncviewer.html; (make a shortcut on your desktop)
- Download and install putty, if you don't have it already. Once you install and run vpn, you can get putty from the SLAC xweb: https://xweb.slac.stanford.edu
Configure your vncserver (one time)
- vpn into the SLAC network, see https://confluence.slac.stanford.edu/display/NetMan/How+to+Connect+to+SLAC+VPN
- Using putty (or XWin-32 if you prefer) log into iris01.slac.stanford.edu, providing your unix username and password
- Create your vnc password:
- > vncpasswd
Provide a password following the usual SLAC password guidelines.
The password will be stored in ~/.vnc/passwd
To reset the password, run vncpasswd again.
- > vncpasswd
- Protect the password:
- > fs setacl ~/.vnc system:slac none
- > fs setacl ~/.vnc system:authuser none
- Start vncserver to create your xstartup file:
- > vncserver -localhost -nolisten tcp -geometry 1440x900
- Make note of the display number that is returned, for example:
jrock@iris01> vncserver -localhost -nolisten tcp -geometry 1440x900
New 'iris01:3 (jrock)' desktop is iris01:3
Starting applications specified in /u/cd/jrock/.vnc/xstartup
Log file is /u/cd/jrock/.vnc/iris01:3.log
In this case, 3 is the display number, which is a unique ID for your particular vncserver session.
in the following instructions, the display number is indicated by displaynum
- Kill the server:
vncserver -kill :displaynum
for example
vncserver -kill :3
- Edit your vnc xstartup file to invoke kde at startup:
- > emacs ~/.vnc/xstartup
change last line from "twm" & to "startkde&", save and close
- > emacs ~/.vnc/xstartup
Run your vnc server (as needed)
- > vncserver -localhost -nolisten tcp -geometry 1440x900
(or use desired display parameters, see.....)
Again, make note of the displaynum - you'll need to use it to connect from Windows.
The session will continue to run until you -kill it, or until SCCS does.
Warning - tokens, kerberos tickets, vpn, and ssh tunnelling can all conspire to prevent you from reconnecting to an existing vncserver session. See troubleshooting section below. The safest thing is to re-start a vncserver for every use, and -kill it when done.
Connect from Windows (everytime you need to)
- Create a connection to SLAC using vpn (see vpn link above)
- Invoke a command window on your PC:
- click the Start Button in the lower lefthand corner of your screen
- enter Command in the search box
- select "Command line tools" from the list
- In the command window, use putty to create a secure scp tunnel to the vncserver host and vncserver port:
- putty -ssh -L pcport:localhost:59displaynum vncserverhost.slac.stanford.edu
- pcport = port on your pc, 590anything, e.g. 5901
- displaynum = vncserver session as noted when you started the vncserver, use 2 digits with leading 0 if needed, see above
- vncserverhost = host where vncserver is running
- for example
putty -ssh -L 5902:localhost:5903 iris01.slac.stanford.edu
or
putty -ssh -L 5902:localhost:5912 iris02.slac.stanford.edu
- putty -ssh -L pcport:localhost:59displaynum vncserverhost.slac.stanford.edu
- Enter your unix username and password.
- Now run the vnc client.
- In the Server box, enter localhost:pcport
for example localhost:5902 - click OK
- The vnc viewer authentication popup will appear; this could take some time, perhaps up to 30 seconds or a minute.
- Enter your vnc server password (you don't need to enter username in the popup).
- Your linux desktop should appear.
- When you're ready to close the vnc client, simply click the window close icon, "X", at the upper righthand corner of the display.
Troubleshooting
- no vnc ps configured – get exact message here
- this means that your session has lost the ability to read the vnc password file, or can't find the pw file. Here are some things to try:
- Verify you are still connected to SLAC via vpn
- Verify you're putty-ed into the right host and port for your vncserver, and you've specified the right pc port in the vnc client popup.
- log into the vncserver host with normal ports, and verify your vncserver session:
putty -ssh iris01
ps -ef | grep vnc | grep yourusername - If the process is not running, then restart it as detailed above.
- You can try to refresh the vnc password (use vncpasswd command, as detailed above) You can use the same password, or a different one - the goal is to touch the password file.
- Close your putty ssh sessions.
- Re-establish the tunnel to the vncserver port.
- If none of these steps are successful, then you will have to kill the vncserver, restart it, and then reconnect. See above for instructions.
References
SLAC Linux VNC page: http://www.slac.stanford.edu/comp/unix/vnc.html
contacts:
- Judy Rock
- Jingchen Zhou