vnc viewer

A vnc viewer gives you remote access to your CS lab desktop, as if you were sitting in the CS labs at one of our computers

Here’s a quick start. See below for details on each step:

In a terminal window on your home computer:

ssh -Y <username>@<labmachine>.cs.swarthmore.edu

Then, in that same window, once you’re connected to a cs computer, run:

vncserver -geometry 1950x1200

Now, back on your computer, in another terminal window:

ssh -L 5901:127.0.0.1:5901 -C -N -l <username> <labmachine>.cs.swarthmore.edu

And finally, again on your computer, in another terminal window (or whatever vncviewer software you are using):

vncviewer localhost:5901

When you are done, you should stop the vncserver process:

vncserver -kill :1

If you are on a Windows machine, you may need to download a vnc viewer. Download vnc viewer to your own computer at:

download vnc viewer for Windows

For Macs, you can use the built-in Screen Sharing app (see screen shots below). For Linux, you’ll need to install a vncviewer.


Here are the above commands again, with additional details.

In a terminal on your local computer, ssh to the CS lab machine you want to connect to. Here’s an example for uesr zsmith3 connecting to the computer pepper.cs.swarthmore.edu:

ssh -Y zsmith3@pepper.cs.swarthmore.edu

Now run the following command on the CS lab machine you just connected to:

vncserver -geometry 1950x1200

If this is your first time, it will ask you to set up a password to control access (max 8 characters).

Next, run the following command on a local terminal on your computer. This sets up an ssh tunnel (again, assuming user is zsmith3 and computer is pepper):

ssh -L 5901:127.0.0.1:5901 -C -N -l  zsmith3   pepper.cs.swarthmore.edu

Finally, connect to localhost:5901 using a remote access app (the vnc viewer or screen sharing app) on your computer. You will need your username and the vnc password you just set up.


For Mac users, here are some screen shots of using the built-in screen sharing app:


And here’s a detailed example for Linux, where my username is testf202, and I’m connecting to finch from mycomputer.

Connect to CS computer and run vncserver:

mycomputer$ ssh -Y testf202@finch.cs.swarthmore.edu
Password: 
Welcome to: finch   
finch[~]$ vncserver -geometry 1950x1200

You will require a password to access your desktops.
Password: 
Verify:   
Would you like to enter a view-only password (y/n)? n

New 'X' desktop is finch:1

Creating default startup script /home/testf202/.vnc/xstartup
Starting applications specified in /home/testf202/.vnc/xstartup
Log file is /home/testf202/.vnc/finch:1.log

finch[~]$ 

Set up ssh tunnel:

mycomputer$ ssh -L 5901:127.0.0.1:5901 -C -N -l testf202 finch.cs.swarthmore.edu          
Password: 

(That’s asking for my cs password)

Run the vncviewer from my computer:

mycomputer$ vncviewer localhost:5901
Connected to RFB server, using protocol version 3.8
Enabling TightVNC protocol extensions
Performing standard VNC authentication
Password: 
(that's asking for the vnc password)
Authentication successful
Desktop name "testf202's X desktop (finch:1)"
VNC server default format:
  ....
  ....
Same machine: preferring raw encoding

When finished, close all windows and kill off the vncserver:

finch[~]$ vncserver -kill :1
Killing Xtightvnc process ID 38265

Back to SwatCS Help Docs