X2Go is a high-performance, open-source remote desktop solution capable of delivering secure, encrypted graphical desktop sessions even over low-bandwidth or high-latency network links. It works similarly to VNC but features built-in SSH-based encryption, making it a popular replacement for legacy solutions like the Oracle Sun Ray virtualization environment.
This guide is part of our enterprise VDI series. Previously, we configured the DHCP Server, TFTP Server, and Local Yum Repositories.
Now, we will install the X2Go server components on our central deployment server.
1. Configuring a Separate SSH Daemon for X2Go
X2Go utilizes SSH tunneling for secure, encrypted data transfers.
If your default SSH daemon (on port 22) is hardened (e.g., TCP port forwarding is disabled), X2Go client features will fail. To work around this, we will deploy a separate instance of the SSH daemon dedicated to X2Go, listening on TCP port 2748, with a custom configuration.
Open Firewall Ports
Allow incoming SSH traffic on custom port 2748:
firewall-cmd --zone=public --add-port=2748/tcp --permanent
firewall-cmd --reload
Create Custom SSH Configuration
Copy the default system SSH server configuration to a separate file:
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_x2go
Modify the listening port to 2748 inside this new configuration file:
sed -i -e 's/#Port 22/Port 2748/g' /etc/ssh/sshd_config_x2go
Define a Systemd Service
Create a new systemd service /usr/lib/systemd/system/x2go-sshd.service for the custom SSH daemon:
cat > /usr/lib/systemd/system/x2go-sshd.service <<EOF
[Unit]
Description=X2GO-OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target sshd-keygen.service
Wants=sshd-keygen.service
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/sshd
ExecStart=/usr/sbin/sshd -D -f /etc/ssh/sshd_config_x2go \$OPTIONS
ExecReload=/bin/kill -HUP \$MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
EOF
Reload and Start x2go-sshd Service
systemctl daemon-reload
systemctl enable x2go-sshd.service && systemctl restart x2go-sshd.service
2. Installing the Desktop Environment (XFCE)
X2Go works exceptionally well with XFCE, which is lightweight, fast, and handles low-bandwidth links smoothly. We will install a minimal set of GUI and driver packages.
Install XFCE GUI Packages
yum groupinstall -y Fonts
yum install -y xfdesktop xorg-x11-server-Xorg xorg-x11-xinit xorg-x11-font-utils xorg-x11-xauth xorg-x11-utils xorg-x11-fonts* lightdm xfce4-session xfce4-session-engines xfce4-settings xfce4-terminal Thunar tumbler xscreensaver
Install VM Drivers & Tools
Since we are operating inside a virtual machine, deploy the integration guest desktop tools and X11 drivers for smooth cursor transitions:
yum install open-vm-tools-desktop.x86_64 xorg-x11-drv-evdev -y
Reboot to Initialize GUI
reboot
3. Installing the X2Go Server Components
Once the system is back online, install the core X2Go server software:
yum install x2goserver x2goserver-xsession -y
Enable X2Go Session Service
systemctl enable x2gocleansessions.service
4. Security & GUI Hardening
To ensure strict Data Leakage Protection (DLP) inside our thin client environment, we will disable local mounting and system file clipboard actions on the server.
Disable Clipboard Access
Disable the clipboard transfer options inside the server options:
sed -i 's/#X2GO_NXAGENT_DEFAULT_OPTIONS+=\" -clipboard both\"/X2GO_NXAGENT_DEFAULT_OPTIONS+=\" -clipboard none\"/g' /etc/x2go/x2goagent.options
Disable Local Drives on User Desktops
Configure the default XFCE desktop manager xml settings /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml to hide filesystem, removable drives, and trash icons from users:
>/etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
cat > /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-desktop" version="1.0">
<property name="backdrop" type="empty">
<property name="screen0" type="empty">
<property name="monitor0" type="empty">
<property name="workspace0" type="empty">
<property name="color-style" type="int" value="0"/>
<property name="image-style" type="int" value="5"/>
<property name="last-image" type="string" value="/usr/share/backgrounds/images/default.png"/>
</property>
<property name="workspace1" type="empty">
<property name="color-style" type="int" value="0"/>
<property name="image-style" type="int" value="5"/>
<property name="last-image" type="string" value="/usr/share/backgrounds/images/default.png"/>
</property>
<property name="workspace2" type="empty">
<property name="color-style" type="int" value="0"/>
<property name="image-style" type="int" value="5"/>
<property name="last-image" type="string" value="/usr/share/backgrounds/images/default.png"/>
</property>
<property name="workspace3" type="empty">
<property name="color-style" type="int" value="0"/>
<property name="image-style" type="int" value="5"/>
<property name="last-image" type="string" value="/usr/share/backgrounds/images/default.png"/>
</property>
</property>
</property>
</property>
<property name="desktop-icons" type="empty">
<property name="file-icons" type="empty">
<property name="show-filesystem" type="bool" value="false"/>
<property name="show-removable" type="bool" value="false"/>
<property name="show-trash" type="bool" value="true"/>
</property>
</property>
<property name="last" type="empty">
<property name="window-width" type="int" value="672"/>
<property name="window-height" type="int" value="551"/>
</property>
</channel>
EOF
Reboot the machine one final time:
reboot
5. Connecting via the X2Go Client
Your remote desktop server is now fully configured!
To connect:
- Download and install the latest X2Go Client.
- Create a new Session:
- Host: The IP address or DNS name of your CentOS server.
- SSH Port:
2748(do not use default port 22). - Login: Your Linux user account name.
- Session Type:
XFCE.
- Save and click on the session card, input your login credentials, and click OK.
Upon successful authentication, the desktop session will load, delivering a lightweight, secure, and fast remote desktop session to your thin client!