TigerVNC
TigerVNC is a client/server software package allowing remote network access to graphical desktops.
Installation
USE flags
USE flags for net-misc/tigervnc Remote desktop viewer display system
dri3
|
Build with DRI3 support |
drm
|
Build with DRM support |
gnutls
|
Prefer net-libs/gnutls as SSL/TLS provider (ineffective with USE=-ssl) |
java
|
Build TigerVNC Java viewer |
nls
|
Add Native Language Support (using gettext - GNU locale utilities) |
opengl
|
Add support for OpenGL (3D graphics) |
server
|
Build TigerVNC server |
viewer
|
Build TigerVNC viewer |
xinerama
|
Add support for querying multi-monitor screen geometry through the Xinerama API |
Emerge
root #
emerge --ask net-misc/tigervnc
Additional Software
The following package can be installed to integrate the VNC server into Xorg:
root #
emerge --ask net-misc/tigervnc-xorg-module
User Session Configuration
The easiest way to use TigerVNC as a server is to run the x0vncserver component with the user's X session:
~/.xinitrc
...
x0vncserver -PasswordFile ~/.vnc/passwd
...
The password file can be defined with:
user $
mkdir .vnc
user $
vncpasswd .vnc/passwd
user $
chmod 600 .vnc/passwd
Localhost Session
A VNC server can be started on localhost instead of on the network, allowing it to be forwarded over SSH, this can be accomplished with:
~/.xinitrc
...
x0vncserver -PasswordFile ~/.vnc/passwd -localhost
...
A SSH connection can be made, forwarding 127.0.0.1:5900
on the destination machine to port 5900 on the client:
user $
ssh -L 5900:127.0.0.1:5900 larry@remoteMachine
This ssh session must remain open for the VNC session to function.
Single Server Configuration
This configuration allows remote control of the entire Xorg X11 server. net-misc/tigervnc-xorg-module is required.
Create the TigerVNC config file for Xorg X11:
root #
mkdir -p /etc/X11/xorg.conf.d
/etc/X11/xorg.conf.d/40-vnc.conf
Section "Module"
Load "vnc"
EndSection
Section "Screen"
Identifier "Default Screen"
Option "PasswordFile" "/etc/X11/vncpasswd"
EndSection
Create /etc/X11/vncpasswd
root #
vncpasswd /etc/X11/vncpasswd
Multiple Server Configuration
Starting with version 1.12, tigervnc no longer supports starting servers as 'normal' user. A global configuration with sessions is now required. The following can still be used to test configuration.
Login as 'normal' user. The following steps can be taken for any user who wishes to configure the VNC server for remote connection.
Set a password:
user $
vncpasswd
Start the server giving it an unused display number (for example :1 or :2):
user $
vncserver :N
If desired, use a VNC client on either a local or remote machine to test the connection.
Once finished, kill the running vncserver by pressing C-c.
Displays
Setup the displays for OpenRC. Substitute each 'user
' value below with the name of a user who will be running the VNC server on the machine:
/etc/conf.d/tigervnc
DISPLAYS="user:1 user2:2"
Typically the value of :0
will be used for the server's own X display. This is why the example above starts by using the :1
display handle.
The above step is not required for systemd.
Starting all TigerVNC sessions in the same OpenRC service has a major drawback: if one session crashes, it cannot be restarted without killing all the others. Starting with 1.13.1-r3, TigerVNC will be migrated to a one session per service model, similar to what systemd does. The above step is no longer required, as the DISPLAYS variable is no longer used.
Setup the displays in the TigerVNC configuration file:
/etc/tigervnc/vncserver.users
:1=user
:2=user2
Desktop environments
To setup the default desktop environment, add it to session=
(or uncomment one from below):
/etc/tigervnc/vncserver-config-defaults
# session=gnome
# securitytypes=vncauth,tlsvnc
# geometry=2000x1200
# localhost
# alwaysshared
# Other possible working sessions:
#session=e16-session
#session=enlightenment
#session=fvwm
#session=gnome-classic
#session=gnome-custom-session
#session=gnome
#session=gnome-xorg
#session=LXDE
#session=lxqt
#session=openbox
#session=plasma
#session=xfce
#session=Xsession
Each user who will be running a VNC server can override this configuration by adding it to ~/.vnc/config
. There is a file /etc/tigervnc/vncserver-config-mandatory
where the system administrator can override user's config. ~/.vnc/xstartup
is no longer supported and the current server ignores it.
Configuration
Service
OpenRC
Up to 1.13.1-r2:
Start the server:
root #
rc-service tigervnc start
Start the server at startup:
root #
rc-update add tigervnc default
Migrating from 1.13.1-r2 or lower:
Stop the global tigervnc service and remove it from startup:
root #
rc-service tigervnc stop
root #
rc-update del tigervnc
Configure tigervnc with one service per display.
From to 1.13.1-r3:
This example assumes 2 displays, :1 and :2
Create one link for every display:
root #
ln -s tigervnc /etc/init.d/tigervnc.1
root #
ln -s tigervnc /etc/init.d/tigervnc.2
Start the server(s):
root #
rc-service tigervnc.1 start
root #
rc-service tigervnc.2 start
Start the server(s) at startup:
root #
rc-update add tigervnc.1 default
root #
rc-update add tigervnc.2 default
Even having only one display requires creating a symlink.
systemd
Start the server:
root #
systemctl enable vncserver@:<display>.service
for each :display
in /etc/tigervnc/vncserver.users
Usage
Connecting
user $
vncviewer server:1
Connect over ssh with high resolution
user $
vncviewer -Fullcolor -QualityLevel 9 -via user@remotehost localhost:1
user $
vncviewer -Fullcolor -QualityLevel 9 -via user2@remotehost localhost:2
See also
- SSH — the ubiquitous tool for logging into and working on remote machines securely.