Chapter 15. TigerVNC

download PDF
TigerVNC (Tiger Virtual Network Computing) is a system for graphical desktop sharing which allows you to remotely control other computers.
TigerVNC works on the client-server principle: a server shares its output (vncserver) and a client (vncviewer) connects to the server.

15.1. VNC Server

vncserver is a utility which starts a VNC (Virtual Network Computing) desktop. It runs Xvnc with appropriate options and starts a window manager on the VNC desktop. vncserver allows users to run separate sessions in parallel on a machine which can then be accessed by any number of clients from anywhere.

15.1.1. Installing VNC Server

To install the TigerVNC server, run the following command as root:
~]# yum install tigervnc-server

15.1.2. Configuring VNC Server

The VNC server can be configured to start a display for one or more users, provided that accounts for the users exist on the system, with optional parameters such as for display settings, network address and port, and security settings.

Procedure 15.1. Configuring a VNC Display for a Single User

  • Specify the user name and the display number by editing /etc/sysconfig/vncservers and adding a line in the following format:
    The VNC user names must correspond to users of the system.

    Example 15.1. Setting the Display Number for a User

    For example, to configure display number 3 for user joe, open the configuration file for editing:
    ~]# vi /etc/sysconfig/vncservers
    Add a line as follows:
    Save and close the file.
    In the example above, display number 3 and the user joe are set. Do not use 0 as the display number since the main X display of a workstation is usually indicated as 0.

Procedure 15.2. Configuring a VNC Display for Multiple Users

  • To set a VNC display for more than one user, specify the user names and display numbers by editing /etc/sysconfig/vncservers and adding a line in the following format:
    VNCSERVERS="display_number:user display_number:user"
    The VNC user names must correspond to users of the system.

    Example 15.2. Setting the Display Numbers for Two Users

    For example, to configure two users, open the configuration file for editing:
    ~]# vi /etc/sysconfig/vncservers
    Add a line as follows:
    VNCSERVERS="3:joe 4:jill"

Procedure 15.3. Configuring VNC Display Arguments

  • Specify additional settings in the /etc/sysconfig/vncservers file by adding arguments using the VNCSERVERARGS directive as follows:
    VNCSERVERS="display_number:user display_number:user"
    Table 15.1. Frequently Used VNC Server Parameters
    -geometryspecifies the size of the VNC desktop to be created, default is 1024x768.
    -nolisten tcpprevents connections to your VNC server through TCP (Transmission Control Protocol)
    -localhostprevents remote VNC clients from connecting except when doing so through a secure tunnel
    See the Xvnc(1) man page for further options.

    Example 15.3. Setting vncserver Arguments

    Following on from the example above, to add arguments for two users, edit the /etc/sysconfig/vncservers file as follows:
    VNCSERVERS="3:joe 4:jill"
    VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -localhost"
    VNCSERVERARGS[2]="-geometry 1920×1080 -nolisten tcp -localhost"

Procedure 15.4. Configuring VNC User Passwords

  • To set the VNC password for all users defined in the /etc/sysconfig/vncservers file, enter the following command as root:
    ~]# vncpasswd
    To set the VNC password individually for a user:
    ~]# su - user
    ~]$ vncpasswd


    The stored password is not encrypted; anyone who has access to the password file can find the plain-text password.

15.1.3. Starting VNC Server

In order to start a VNC desktop, the vncserver utility is used. It is a Perl script which simplifies the process of starting an Xvnc server. It runs Xvnc with appropriate options and starts a window manager on the VNC desktop. There are three ways to start vncserver:
  • You can allow vncserver to choose the first available display number, start Xvnc with that display number, and start the default window manager in the Xvnc session. All these steps are provided by one command:
    ~]$ vncserver
    You will be prompted to enter a VNC password the first time the command is run if no VNC password has been set.
  • Alternately, you can specify a specific display number:
    vncserver :display_number
    vncserver attempts to start Xvnc with that display number and exits if the display number is not available.
    For example:
    ~]$ vncserver :20
  • Alternately, to start VNC server with displays for the users configured in the /etc/sysconfig/vncservers configuration file, as root enter:
    ~]# service vncserver start
    You can enable the vncserver service automatically at system start. Every time you log in, vncserver is automatically started. As root, run
    ~]# chkconfig vncserver on

15.1.4. Terminating a VNC Session

Similarly to enabling the vncserver service, you can disable the automatic start of the service at system start:
~]# chkconfig vncserver off
Or, when your system is running, you can stop the service by issuing the following command as root:
~]# service vncserver stop
To terminate a specific display, terminate vncserver using the -kill option along with the display number.

Example 15.4. Terminating a Specific Display

For example, to terminate display number 2, run:
~]# vncserver -kill :2

Example 15.5. Terminating an Xvnc process

If it is not possible to terminate the VNC service or display, terminate the Xvnc session using the process ID (PID). To view the processes, enter:
~]$ service vncserver status
Xvnc (pid 4290 4189) is running...
To terminate process 4290, enter as root:
~]# kill -s 15 4290
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.