Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 12. Remotely accessing the desktop as multiple users
You can remotely connect to the desktop on a RHEL server and open multiple sessions as different users at the same time.
Prerequisites
Install the VNC server:
dnf install tigervnc-server
# dnf install tigervnc-serverCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the VNC client:
dnf install tigervnc
# dnf install tigervncCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
12.1. The mapping of port and display numbers to users in VNC Link kopierenLink in die Zwischenablage kopiert!
With VNC, the client can connect to the desktop sessions of different users on the server. A display number and a TCP port number are attached to each server user that exports a VNC session. The client uses the port number to specify which server user it connects to.
If several clients connect using the same port number, they all open a VNC session to the same server user.
You must configure a mapping for each server user that exports a VNC session. For every such user, you must pick a unique port and display number.
The recommended mapping
Red Hat recommends that you start with port number 5902 and display number 2 for the first user, and increment the numbers by one for each additional server user.
Port number 5900 and display number 0 represent the server user that is currently logged into the graphical session. You cannot start a VNC server for the user who is already logged into the graphical session.
| Port number | Display number | Note | 
|---|---|---|
|   5900  |   0  |   The logged-in user  | 
|   5901  |   1  | |
|   5902  |   2  |   The first recommended VNC user  | 
|   5903  |   3  | |
|   …  |   …  | 
					Red Hat recommends that you do not configure the root user to export a VNC session. A root VNC session is unsafe and certain elements of the session might not work as expected.
				
Firewall rules
					You must open the selected ports in your firewall configuration. Allowing the vnc-server service in your firewall opens ports from 5900 to 5903. If you need to enable access to additional server users, you must open ports above 5903 by manually specifying the port numbers.
				
12.2. VNC server configuration files Link kopierenLink in die Zwischenablage kopiert!
Several configuration files affect the behavior of the VNC server. You can configure the user mapping and various global options.
					Starting with TigerVNC 1.14, the configuration files are stored under $HOME/.config/tigervnc and the state files, such as logs and saved_sessions, under $HOME/.local/state/tigervnc.
				
General options
					You can configure general options of the VNC server in the /etc/tigervnc/vncserver-config-defaults configuration file. The file uses the following format:
				
option1=value option2
option1=value
option2
For example:
session=gnome alwaysshared securitytypes=vncauth,tlsvnc desktop=sandbox geometry=2000x1200
session=gnome
alwaysshared
securitytypes=vncauth,tlsvnc
desktop=sandbox
geometry=2000x1200
The priority of configuration files
The VNC server reads the following files for general options, in order from most important to least important:
/etc/tigervnc/vncserver-config-mandatoryThis file replaces the default configuration and has a higher priority than the per-user configuration. It is intended for system administrators who want to enforce particular VNC options.
$HOME/.vnc/configIndividual users can override the default VNC configuration in this file.
/etc/tigervnc/vncserver-config-defaultsThis file stores the default VNC configuration.
User mapping
					You can configure the mapping between users and their associated port and display numbers in the /etc/tigervnc/vncserver.users configuration file. The file uses the following format:
				
:number=user
:number=user
For example:
:2=test :3=vncuser
:2=test
:3=vncuser
12.3. Enabling multi-user VNC access on the server Link kopierenLink in die Zwischenablage kopiert!
This procedure configures a RHEL server so that multiple users can open VNC sessions on it at the same time.
Prerequisites
If you previously configured VNC using
systemdunit files, remove any outdated VNC configuration:rm /etc/systemd/system/vncserver@.service
[root]# rm /etc/systemd/system/vncserver@.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
Procedure
Map users to display and port numbers.
In the
/etc/tigervnc/vncserver.usersconfiguration file, add a line for each server user that will export a VNC session::user-number=user-name
:user-number=user-nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace user-number with the port and display number mapped to the selected existing user.
 - Replace user-name with the user name of the selected existing user.
 
For example:
:2=vncuser
:2=vncuserCopy to Clipboard Copied! Toggle word wrap Toggle overflow Open TCP ports 5900 to 5903 in the firewall:
firewall-cmd --permanent --add-service=vnc-server
[root]# firewall-cmd --permanent --add-service=vnc-serverCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reload the firewall rules:
firewall-cmd --reload
[root]# firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following lines to the
/etc/tigervnc/vncserver-config-defaultsconfiguration file:session=gnome alwaysshared
session=gnome alwayssharedCopy to Clipboard Copied! Toggle word wrap Toggle overflow This configuration has the following effects:
- The VNC server starts the GNOME session when a remote user logs in.
 - Multiple users can connect to the VNC server at the same time.
 
As each server user that exports a VNC session, set the VNC password for the user:
vncpasswd
[regular-user]$ vncpasswdCopy to Clipboard Copied! Toggle word wrap Toggle overflow Remote clients must enter this password when connecting to the desktop on the server.
If you previously configured VNC for the user, ensure that the configuration files have the correct SELinux context:
restorecon -RFv ~/.vnc
[regular-user]$ restorecon -RFv ~/.vncCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enable and start the VNC server unit for the regular user:
systemctl enable --now vncserver@:user-number
[root]# systemctl enable --now vncserver@:user-numberCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the server uses the proprietary Nvidia driver, disable Wayland:
- 
								Uncomment the 
WaylandEnable=Falseline in the/etc/gdm/custom.confconfiguration file. - 
								Add the 
DefaultSession=gnome-xorg.desktopoption to the[daemon]section of the configuration file. - Reboot the server.
 
- 
								Uncomment the 
 
12.4. Connecting to the VNC server as multiple users Link kopierenLink in die Zwischenablage kopiert!
				This procedure connects to a remote desktop session using the vncviewer application. You can open multiple connections to the remote desktop at the same time.
			
Prerequisites
- Remote desktop access for multiple users is enabled on the server. For details, see Enabling multi-user VNC access on the server.
 
Procedure
Connect to the VNC server:
vncviewer --shared server-ip:display
$ vncviewer --shared server-ip:displayCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace server-ip with the IP address of the server that you are connecting to.
 - Replace display with the display number where the server user exports the VNC session.