Questo contenuto non è disponibile nella lingua selezionata.
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
root
:
~]# yum install tigervnc-server
15.1.2. Configuring VNC Server
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 number3
for userjoe
, open the configuration file for editing:~]#
vi /etc/sysconfig/vncservers
Add a line as follows:VNCSERVERS="3:joe"
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" VNCSERVERARGS[display_number]="arguments"
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 theXvnc(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 asroot
:~]#
To set the VNC password individually for a user:vncpasswd
Password: Verify:~]#
su - user
~]$vncpasswd
Password: Verify: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
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.vncserver
- 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, asroot
enter:~]#
service vncserver start
You can enable thevncserver
service automatically at system start. Every time you log in,vncserver
is automatically started. Asroot
, run~]#
chkconfig vncserver on
15.1.4. Terminating a VNC Session
vncserver
service, you can disable the automatic start of the service at system start:
~]# chkconfig vncserver off
root
:
~]# service vncserver stop
vncserver
using the -kill
option along with the display number.
Example 15.4. Terminating a Specific Display
~]# vncserver -kill :2
Example 15.5. Terminating an Xvnc process
~]$ service vncserver status
Xvnc (pid 4290 4189) is running...
4290
, enter as root
:
~]# kill -s 15 4290