VNC Server and its configuration in Linux

FacebookStumbleUponGoogle BuzzGoogle ReaderLinkedInOrkutShare


VNC stands for Virtual Network Computing. It is, in essence, a remote display system which allows you to view a computing `desktop’ environment not only on the machine where it is running, but from anywhere on the Internet and from a wide variety of machine architectures. It is implemented in a client/ server model. This package provides a fully functional X server, to which a VNC viewer can connect. Note: This server does not support or need a display. You need a vncviewer to see something. However, this viewer may also be on a computer running other operating systems in the local net. This package is an enhanced version of VNC including TightVNC allowing it to be optimized to work over slow network connections such as low-speed modem links so you can work remotely almost in real time in most environments.

Most of the time as a system administrator you are managing your servers over the network. It is very rare that you will need to have a physical access to any of your managed servers. In most cases all you need is to SSH remotely to do your administration tasks. In this article we will configure a GUI alternative to a remote access to your RHEL server, which is VNC. VNC allows you to open a remote GUI session to your server and thus providing you with a full graphical interface accessible from any remote location

Installation of VNC server

In order to enable an access to our Redhat Linux system using VNC we first need to install it. Make sure that you have your repository enabled and execute the command:

#  yum install tigervnc-server

The above command will install the VNC server on your system.

Setting up VNC session

At this point we should have VNC server installed on our system and thus we are ready to setup sessions. In VNC you can define a separate access session for each particular user. For this we will use VNC configuration file: /etc/sysconfig/vncservers

To configure VNC for a user “sam” /etc/sysconfig/vncservers file insert the following lines:

VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp -localhost”

The above will configure VNC session 2 for a user lubos with specified geometry windows size. -nolisten and -localhost are added as a security precaution. You can omit -nolisten and -localhost and connect to VNC directly. In that case you will need to open a VNC port on your firewall. It is recommended to use -nolisten and -localhost option and thus allow clients to connect only via existing secure ssh port 22 using the SSH tunnel.

Before you start the VNC service, first you will need to create a VNC password for each user session you have configured in /etc/sysconfig/vncservers. To do that su to each user and execute:

[[email protected] ~]# su sam
[[email protected] root]$ vncpasswd
[[email protected] root]$

At this point you will be able to start the VNC service with the command:

# service vncserver start

Connecting to VNC server

If you allowed your clients to connect to your VNC server without the secure SSH tunnel, you first need to make sure that your firewall allows this connection. Then simply connect to your VNC using:

$ vncviewer sdc.server:2

Connected to RFB server, using protocol version 3.8

Performing standard VNC authentication

Authentication successful

where sdc.server is a hostname or IP address of your server and number 2 is a session number you have configured for your user. Once you enter a correct password your session will start.

4.1. Connecting to VNC server via SSH tunel

It is recommend to connect to VNC via ssh tunnel. This can be easily done using vncviewer -via option with will automatically create an ssh tunnel for you:

$ vncviewer -via [email protected] localhost:2

First, you will be prompted for a password:

Once you enter a correct password for your VNC user your VNC session will start:


VNC is a great tool for remote connection to you server when GUI interface is needed. It also has an advantage of running task remotely and keep them alive even once your network connection to a remote VNC was disconnected. This is a quite useful if you run some important GUI updates, which may take several hours and you do not want to kill this update simply by losing a network connection






Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>