Accessing an X-windows session from home
An X-windows session can be viewed over the internet from any type
of computer (Linux, Windows, Apple). This will allow the use of
programs such as Maple, Matlab, R, Splus, SAS, LaTeX, Ghostview, etc.
(including graphics capabilities).
Through the combined use of SSH and VNC, a secure X-windows session
can be initiated. SSH will also allow the use of VNC through a firewall
(such as the firewall on Res-net at Montana State University). The
tutorial below is assuming that we are installing the vnc server on a
machine called "gauss". Install the server on the machine you really
intend to!
Installing VNC on gauss
The latest version of VNC might not be installed on gauss. However,
as long as you have shell access to gauss, it is possible to install it
in your own home directory. A guideline is shown below. The steps need
to be done on gauss, or alternatively, the Solaris binaries can be
downloaded and transferred to gauss using scp. One option is to use the
links text-based web browser -- a very nice solution!
- Download VNC from https://www.realvnc.com/download.html. Look for the Free
Solaris 7 (SPARC) (GZipped Tarfile)) Edition.
- Unzip the tar.gz file with
gunzip vnc-4_1_1-sparc_solaris.tar.gz
- Untar the archive using the command
tar -xvf vnc-4_1_1-sparc_solaris.tar
- Enter the directory created by the archive and enter the
following command:
vncinstall ~/bin ~/man
- If you prefer, you can clean up the installation files with the
following commands (Beware of the rm -rf command! You can delete
the contents of an entire directory this way. Make sure you name
the correct directory before hitting enter!)
cd ..
rm -rf vnc-4_1_1-sparc_solaris
rm vnc-4_1_1-sparc_solaris.tar
- Edit the ~/.vnc/xstartup file to choose an appropriate
windows manager. Alternatively, download xstartup, which uses the xfwm windows
manager (Save in the ~/.vnc directory).
Starting a VNC Server session on gauss from home using Putty
If a Mac or any other platform is used, then download the
appropriate VNC viewer along with an ssh client. Another
ssh option is the Mindterm Java SSH client. It has the ability to
initiate tunnels (in version 2.0 or newer). Since it was
written in Java, you can use it in any web-enabled browser.
The steps below illustrate the use of VNC through Putty, a free SSH
client for Windows. Use the steps below as a guideline for other
platforms.
- First, download the file putty.exe from here.
Save it to the desktop or to any other directory you'd like to
keep it in.
- Double click on the putty icon. Then type in what is in the
window below. Click Save. Click on gauss. Click Open.
- A putty window will now appear. Log into gauss. The first time
putty is used to log into gauss, it will say "The
authenticity of host 'gauss.math.montana.edu' can't be
established". Check the key fingerprint putty specifies is the
actual gauss fingerprint. Click yes if
the fingerprints match. At the command prompt, type
vncserver.
If you see a message similar to below, then a VNC server was
successfully started. The first time the program is run,
it will ask you to choose a password. Choose a password
different from your gauss password (although your gauss password
would be fine). Make a note of the
display number of the VNC server (3 in the window below).
- Logout from the putty session by typing logout. Be sure
and remember the display number of the VNC server.
- You only need to start a VNC server once (unless gauss has been
rebooted, which happens about every 3 months).
If you want to kill a VNC session, the display name and
number are required. Current session names can be found in the ~/.vnc
directory (off of your home directory). The command is:
vncserver -kill gauss:3
Setting up an SSH tunnel using Putty
In order to connect securely to a VNC Server, you need to set up
an SSH tunnel. This guide should provide adequate details for
establishing an SSH tunnel using Putty on Windows 95/98/ME/2000/XP.
Other SSH programs can be used, including the one from ftp://ftp.ssh.com/pub/ssh (download
the file called SSHSecureShellClient). This tutorial will focus on the
procedures for Putty, though similar procedures will work for the
ssh.com client.
- First, a putty session for use with VNC must be set up. Double
click on the putty icon. Click on the SSH tab on the
left. Then click on 2 for the preferred SSH protocol.
- Next, Click on the Tunnels tab. For
Source port, type 5901. For Destination, type
localhost:59xx, where xx is the display number from the
previous section (03 in this
example.) Click on the dot next to Local. Click on Add.
- The window should now look like this. Click on the Session
tab.
- Next, enter the information below and choose a Session name under
the Saved Sessions window. Click on Save.
- Click on Cancel (We don't want to connect to gauss yet). We
want to set up a shortcut on the desktop which starts an ssh tunnel
for VNC.
- Right click on the putty.exe
icon. Select Create Shortcut.
- Right click on the shortcut icon, and select rename. Choose
vnc as its new name (or any other name you want). Move
the shortcut to the desktop if it isn't there already.
- Right click on the VNC shortcut icon. Select properties.
- At the end of the Target line (after putty.exe), enter -load
"session", where session is the session name you chose
before ("gauss (vnc)" in this
example). If there is a quotation
mark after putty.exe, then enter -load "session" after
the quotation mark. Click OK.
- Next, download the Windows VNC viewer command. It is located at
https://www.realvnc.com/download.html.
Select Download and Use the Free Edition, then click on Proceed to
download. Download the executable(.exe) in the Windows Stand Alone
Viewer part. Save it to the desktop or to any other directory you'd
like. (Rename it if you like. I renamed this one to
vncviewer.exe). If you save it somewhere else besides the desktop,
I'd suggest you make a shortcut to it on the desktop like the vnc shortcut.
Connecting to a running VNC server
- Double click on the VNC icon. Login to gauss. DO NOT CLOSE
this window while you are using the VNC viewer. An SSH tunnel has
been initiated that will exchange information between the VNC
server and the VNC viewer. The best idea is to minimize the
window. Click on the underscore button in the top right of the
putty window.
- Double click on the VNC viewer icon. Type in localhost:1
for the VNC server part. Click OK.
- Enter your VNC server password.
- Your VNC session should pop up.
- Now try and run SAS, Splus, Maple, Matlab, etc.
If you find the password prompt does not come up, but rather says that
it was unable to connect, then gauss was probably rebooted. You need
to start a new VNC server.
Scott Hyde
Last modified: Fri Jan 19 01:18:12 HST 2018