Chapter 15. TigerVNC 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 : 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: VNCSERVERS=" display_number : user " 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: 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: Add a line as follows: 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: Table 15.1. Frequently Used VNC Server Parameters VNCSERVERARGS Definition -geometry specifies the size of the VNC desktop to be created, default is 1024x768. -nolisten tcp prevents connections to your VNC server through TCP (Transmission Control Protocol) -localhost prevents 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: 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 : To set the VNC password individually for a user: Important 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: 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: Alternately, to start VNC server with displays for the users configured in the /etc/sysconfig/vncservers configuration file, as root enter: You can enable the vncserver service automatically at system start. Every time you log in, vncserver is automatically started. As root , run 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: Or, when your system is running, you can stop the service by issuing the following command as root : 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: 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: To terminate process 4290 , enter as root :

Commands:
~]# yum install tigervnc-server
~]# vi /etc/sysconfig/vncservers
VNCSERVERS="3:joe"
~]# vi /etc/sysconfig/vncservers
VNCSERVERS="3:joe 4:jill"
VNCSERVERS=" display_number : user display_number : user " VNCSERVERARGS[ display_number ]=" arguments "
VNCSERVERS="3:joe 4:jill" VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -localhost" VNCSERVERARGS[2]="-geometry 1920x1080 -nolisten tcp -localhost"
~]# vncpasswd Password: Verify:
~]# su - user ~]USD vncpasswd Password: Verify:
~]USD vncserver
~]USD vncserver :20
~]# service vncserver start
~]# chkconfig vncserver on
~]# chkconfig vncserver off
~]# service vncserver stop
~]# vncserver -kill :2
~]USD service vncserver status Xvnc (pid 4290 4189) is running
~]# kill -s 15 4290