VNC tutorial
João Vaz
Client VNC and Linux
server configuration
(Alameda and TagusPark)
João Vaz
Wireless Integrated Circuits and Systems
IST
September 2021
1
VNC tutorial
João Vaz
• Introduction
- This tutorial explains how to access a Linux workstation (server) from a
windows PC or a Mac OS (client) with vnc protocol.
- It is assumed that the server has vncserver installed.
- The Windows client has a vnc client [1] and ssh client installed [2].
- The Mac client has a native vnc and ssh clients in Mac OS. It is also possible
to use a different vnc client [1].
- This tutorial example presents username “user4” connecting to
“micro1.lx.it.pt” server.
For the students case username will be IST ID “ist1x...x” and the server is
described on this tutorial last page.
- vnc has many advantages over ssh with X forwarding. One is the fact that it
doesn’t consumes too much internet bandwidth; the other is that if the
internet connection server-client accidently closes, the restart is possible
without losing anything because the server vncserver and applications are
still running.
2
VNC tutorial
João Vaz
• Starting vncserver (Linux server)
Starting server “vncserver”
Before using VNC connection, vncserver must be running on the server side.
Login to your linux account with ssh (how-to on page 5 for window and MAC
clients). Open a terminal window on the server.
Start vncserver with the command “vncserver :4 -depth 24 -geometry 1440x900”
Once again it was assumed that display number 4 is used.
Options:
-depth 24 defines the pixels depth in number of bits. For cadence
24 value is required.
-geometry defines the client display resolution. It depends on the
client graphic card chosen resolution.
When starting vncserver for the first time, the system ask for a password.
This password is only used for the vnc connection, it is not necessarily
equal to the login one.
3
VNC tutorial
João Vaz
vncserver log file is displayed and the chosen display number is in the log file
name.
vncserver also creates ~/.vnc directory and stores there the logfile, pid file and
passwd file.
The command “vncserver -list” will list the displays you have running.
If necessary, to shutdown vncserver, the command “vncserver -kill :4” should be
used (it was assumed that the display was number 4).
Please, avoid using more than one display
Finally, logout can be performed. After logout vncserver still runs and there is no
need to restart it in the following sessions (*).
(*) If the server runs AFS authentication (like fatima and fatima2 servers), after
logout, vncserver still runs for 8 hours long. After that it must be restarted again.
If the server uses standard Linux authentication, vncserver continues running after
logout for undetermined time (unless a reboot is performed).
4
VNC tutorial
João Vaz
• SSH connection (Windows client)
Filling Putty configuration
Run putty client to make a ssh secure
connection to the server. Fill the server
DNS name on “host name” field. Port
22 is used by default. Fill a name to
identify this connection configuration
on “Saved Sessions” field, and press
“save”. Next time putty is opened the
saved configuration can be loaded.
Client putty GUI
• SSH connection (MAC client)
On Mac OS open a terminal window. Give the command
$ ssh [email protected]
5
VNC tutorial
João Vaz
• SSH access with port forwarding (Windows client)
For starting a VNC session the ssh connection must be configured with a port
forwarding. For that the previous configuration of putty ssh must be complemented.
For that in putty “SSH/tunnels” menu, configure port forwarding. This example will
assume display number 4 is used. So, to use display 4 vncserver will use server port
number 5904 (the rule is port=5900+display_number). So, client local 5904 port must
be forward to server port 5904.
fill these fields
press Add
step 1 step 2
ssh/tunels GUI ssh/tunels GUI
Save the session once again, then make the login by pressing “Open”.
Authenticate with login and password. A terminal window will open from Linux 6
server. Do not close this terminal during the session.
VNC tutorial
João Vaz
• VNC access with vnc viewer (windows client)
Starting client vnc viewer
Run vnc viewer on client machine.
On VNC server field, write “localhost:5904” (or “localhost:4”) instead.
Then enter vncserver password.
There were some reported problems
where the connection to the server
was refused.
For these cases, the problem was
solved by filling the destination field in
putty with “localhost:5904” instead of
“micro1.lx.it.pt:5904”.
Client vnc viewer GUI
7
VNC tutorial
João Vaz
Finally, the desired server desktop image appears in your Windows PC
display. If you want, full screen mode can be used.
To end your work session, close the vncviewer and putty application.
Note: Don’t make logout of your Linux session, otherwise you will get a blank
screen. To solve this, you will need to kill vncserver and start it again in the
server side. But this closes your running server applications.
8
VNC tutorial
João Vaz
• SSH access with port forwarding (Mac OS client)
For starting a VNC session the ssh connection must be configured with a port
forwarding. For that the previous configuration of putty ssh must be complemented.
On Mac OS open a terminal window.
Once again for the same user, server and display number as before, give the
following command.
After entering the password, a terminal window in Linux server will open. Do not
close this terminal windows during the session.
9
VNC tutorial
João Vaz
• VNC access with vnc viewer (Mac client)
Starting macOS vnc viewer builtin client
On the Finder application, chose “Go/Connect to server” menu.
The following window appears.
On “Server address” field write “localhost:4” (or “localhost:5904”) instead.
Then press “connect” and enter vncserver password.
The session can be saved by pressing “+”.
10
VNC tutorial
João Vaz
Finally, the desired server desktop image appears in your Mac display. If you
want, full screen mode can be used.
To end your work session, close the window and ssh connection.
Note: Don’t make logout of your Linux session, otherwise you will get a blank
screen. To solve this, you will need to kill vncserver and start it again in the
server side. But this closes your running server applications.
11
VNC tutorial
João Vaz
• Available cadence server machines at IST
Alameda campus: fatima2.vps.tecnico.ulisboa.pt
Tagus Park campus: fatima.vps.tecnico.ulisboa.pt
Because internal network is firewall protected, files transfer to/from outside
should be done with any sftp client.
• References
[1] vncviewer (http://www.realvnc.com/) is a freeware software. Other equivalent
software can be used.
[2] putty ssh (http://www.putty.org/) is a freeware software. Other equivalent
software can be used.
12