VNC stands for Virtual Network Computing. It is a desktop sharing system that allows you to remotely control another computer. It uses Remote Frame Buffer Protocol (RFB) which allows remote access to graphical user interfaces. VNC transmits the keyboard and mouse inputs from one computer to another and relays the graphical screen back in the direction of the network. This makes it a good choice for customer support as users are connected to the same computer and type and see the same thing on the keyboard. Popular VNC vendors include RealVNC, TightVNC, TigerVNC, TurboVNC, etc.

Features

  • Cross-platform support
  • It is an open protocol
  • VNC Server captures the desktop of the computer in real-time and sends it to VNC Viewer for display.

Xrdp

Xrdp provides a graphical login to remote machines using Microsoft Remote Desktop Protocol (RDP). It primarily supports GNU/Linux operating system. It works by effectively creating a desktop session on the server computer which includes the user profile. It makes it seem as if you are signing in to a physical server. It supports multiple remote users connecting to the same server completely unaware of each other. RDP transport is encrypted using TLS by default. Popular RDP clients that connect to Xrdp include FreeRDP, rdesktop, KRDC, NeutrinoRDP, and Microsoft Remote Desktop Client (for Windows, macOS, iOS, and Android).

Features

  • It supports two-way clipboard transfer (text, bitmap, file)
  • It is a Free and Open-source Remote Desktop Protocol server
  • Audio redirection
  • Drive redirection (mount local client drives on the remote machine)
  • Reconnect to an existing session
  • Session resizing (both on-connect and on-the-fly)

This guide will show you how to Configure VNC and Xrdp server on CentOS 9|AlmaLinux 9|RHEL 9.

Install TigerVNC on CentOS 9|AlmaLinux 9|RHEL 9

As a prerequisite, you should have the GNOME desktop environment installed.

sudo dnf groupinstall -y "Server with GUI"

Update your system packages.

sudo dnf update -y

Disable SELinux.

$ sudo vi /etc/sysconfig/selinux
SELINUX=disabled

Save and exit the file then reboot your system.

sudo reboot

Install TigerVNC with the following command.

sudo dnf install tigervnc-server

Copy the configuration file to /etc/systemd/ directory and mention the display number on which we want the VNC service to listen. If setting up the VNC server for one user, you would not be required to mention the display number. If setting it for multiple users the display number is essential.

sudo cp /usr/lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:2.service

Edit the configuration file to set the Username of an actual user. Save and exit the file.

$ sudo vi /etc/tigervnc/vncserver.users
:2=technixleo

Set the Password for the user configured in the configuration file above.

$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used

Configure the VNC service with the following details.

$ vim ~/.vnc/config
session=gnome
securitytypes=vncauth,tlsvnc
geometry=800x600

Configure Firewall rules to allow VNC service.

sudo firewall-cmd --permanent --add-service=vnc-server
sudo firewall-cmd --permanent --add-port=5902/tcp
sudo firewall-cmd --reload

Set the session to GNOME desktop environment.

echo gnome-session > ~/.session

Start and enable the TigerVNC service.

sudo systemctl start [email protected]:2.service
sudo systemctl enable [email protected]:2.service

Check the status of the service.

$ systemctl status [email protected]:2.service[email protected]:1.service - Remote desktop service (VNC)
     Loaded: loaded (/etc/systemd/system/[email protected]:2.service; enabled; vendor >
     Active: active (running) since Mon 2022-07-11 13:34:28 EAT; 25s ago
   Main PID: 33168 (vncsession)
      Tasks: 0 (limit: 48797)
     Memory: 1.0M
        CPU: 34ms
     CGroup: /system.slice/system-vncserver.slice/[email protected]:2.service
             ‣ 33168 /usr/sbin/vncsession technixleo :2

Access TigerVNC

I will download VNC Viewer for Windows in my case. Download the latest binary release from SourceForge.

Install the application and start the service. Input the IP address of the Linux server and the display port and click OK.

Enter the VNC Password for the user to connect.

The connection is successful when the desktop connection shows.

Install xrdp server on CentOS 9|AlmaLinux 9|RHEL 9

We should Enable EPEL Repository on your system.

You should also have GNOME as the main desktop environment.

sudo dnf groupinstall "Server with GUI"

Update your system.

sudo dnf update -y

Disable SELinux on your system if it is enabled.

$ sudo vi /etc/sysconfig/selinux
SELINUX=disabled

Save and exit the file. Reboot your system for the changes to take effect.

reboot

After Restart, install xrdp with the following command.

sudo dnf install xrdp

Configure the Firewall to accept xrdp traffic.

sudo firewall-cmd --permanent --add-port=3389/tcp
sudo firewall-cmd --reload

Set the session to GNOME.

echo gnome-session >~/.xsession

Start and enable the service.

sudo systemctl enable --now xrdp

Check the status of the service.

$ systemctl status xrdp
● xrdp.service - xrdp daemon
     Loaded: loaded (/usr/lib/systemd/system/xrdp.service; enabled; vendor pres>
     Active: active (running) since Mon 2022-07-11 22:49:10 EAT; 13s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
   Main PID: 21058 (xrdp)
      Tasks: 1 (limit: 48797)
     Memory: 1.0M
        CPU: 4ms
     CGroup: /system.slice/xrdp.service
             └─21058 /usr/sbin/xrdp --nodaemon

Verify xrdp is listening on port 3389.

$ sudo netstat -antup | grep xrdp
tcp6       0      0 ::1:3350                :::*                    LISTEN      3502/xrdp-sesman    
tcp6       0      0 :::3389                 :::*                    LISTEN      3503/xrdp 

Access the Server

Take RDP on any Windows machine via Remote Desktop Connection. Input the Linux server IP address then click Connect.

You can ignore the certification mismatch warning. Click Yes.

Type in the root or username already on the server together with the corresponding password. Then click OK.

With correct credentials, the connection is successful and appears as shown below.

Conclusion

From this Guide, we have learned how to Install and Configure VNC and Xrdp servers on CentOS 9|AlmaLinux 9|RHEL 9. Both Technologies have the same goal of accessing another computer remotely from the host system. It depends on the use, as both of them support multiple platforms.

LEAVE A REPLY

Please enter your comment!
Please enter your name here