How to Install and Securely Configure VNC Server on Ubuntu 26.04 VPS with Xfce and SSH Tunnel
Greetings, friends!
Most system administrators and software developers are accustomed to managing Virtual Private Servers (VPS) exclusively through the SSH command line. However, there is a wide range of tasks where having a full graphical user interface (GUI) on Linux becomes not just an added advantage, but a practical necessity.
Using VNC (Virtual Network Computing) transforms your server into a remote desktop workstation, allowing you to connect seamlessly from anywhere and start working visually. In this guide, we will break down the practical benefits of VNC on a VPS and walk through setting up a lightweight Xfce desktop environment and TightVNC server on Ubuntu 26.04 using a secure SSH tunnel.
Key Takeaways: Core Conclusions
Graphical App Execution & Automation: VNC allows you to run software that lacks CLI alternatives, interact with visual database GUIs, run automated browser workflows (Selenium, Puppeteer), and execute desktop trading terminals.
Xfce is the Ideal Desktop Choice for VPS: Heavy desktop environments (GNOME, KDE) consume gigabytes of system memory. Xfce consumes only 250–300 MB of RAM, leaving maximum resources available for your core workloads. While minimalist, it retains all essential features.
Security via SSH Tunneling: Raw VNC traffic is transmitted unencrypted. Opening VNC ports (such as 5901) directly to the public internet is a major security risk; forwarding connections over an encrypted SSH tunnel is the recommended best practice.
Session Independence: Closing your local VNC client does not terminate your desktop session—all background tasks and applications on the server continue running 24/7.
Why You Need VNC on a VPS: Practical Use Cases
Deploying a VNC server on a Linux VPS is especially useful in the following scenarios:
Automation & Web Testing: Running desktop web browsers for UI testing, data scraping, browser extensions, and automation scripts requiring an active screen display.
Trading & Financial Bots: Running desktop trading software (MetaTrader, TigerTrade) that requires continuous 24/7 visual monitoring and execution.
Hardware-Independent Remote Work: Building a cloud-based development environment (IDEs, database clients, Postman) accessible from any local device worldwide.
Beginner-Friendly Administration: Simplifying server administration for users who are new to Linux and prefer visual file managers and GUI tools over terminal commands.
Personal Experience: Why I Choose TightVNC + Xfce + SSH Tunnel
"In my server administration experience, I learned that while GNOME is a great desktop environment if you have abundant RAM, Xfce is far more practical for virtual servers. By saving system memory, you can easily run extra Docker containers or host additional microservices.
Combining minimalist Xfce with TightVNC delivers near-instant response speeds. Furthermore, port forwarding over an SSH tunnel solves two major challenges simultaneously: it completely encrypts traffic against interception and eliminates the need to expose extra ports on your firewall."
— Anatolie Cohaniuc
Step-by-Step Installation and Configuration Guide for VNC on Ubuntu 26.04
The complete configuration process is demonstrated step-by-step in our YouTube video tutorial:
Step 1: Install Xfce and TightVNC Update your system package lists (00:00:28) and install the Xfce desktop environment, TightVNC server, basic font packages, and D-Bus (00:00:41):
sudo apt update && sudo apt upgrade -y
sudo apt install xfce4 xfce4-goodies tightvncserver -y
sudo apt install xfonts-base xfonts-75dpi xfonts-100dpi dbus-x11 -y
Step 2: Set Your VNC Access Password Create an encrypted access password for your VNC connection (00:01:29):
vncpasswd
Enter a password (between 6 and 8 characters). When prompted to create a view-only password, enter n.
Step 3: Configure Xfce Startup Scripts
Generate the ~/.vnc/xstartup script, instructing the VNC server to launch the Xfce desktop session (00:01:43):
cat << 'EOF' > ~/.vnc/xstartup
#!/bin/bash
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
xrdb $HOME/.Xresources 2>/dev/null
exec dbus-launch --exit-with-session startxfce4
EOF
chmod +x ~/.vnc/xstartup
Step 4: Create a Systemd Service
Create a systemd service unit file for automatic startup (00:01:55):
nano /etc/systemd/system/[email protected]
Insert the following configuration:
[Unit]
Description=TightVNC Server on Display :%i
After=syslog.target network.target
[Service]
Type=forking
User=root
Group=root
WorkingDirectory=/root
PIDFile=/root/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1920x1080 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
Reload systemd, enable auto-start, and verify the service status (00:02:09):
systemctl daemon-reload
systemctl enable [email protected] --now
systemctl status [email protected]
Step 5: Connect to Your Desktop via Encrypted SSH Tunnel On your local computer (Windows, macOS, or Linux), open an SSH tunnel (00:02:39):
ssh -L 5901:127.0.0.1:5901 root@YOUR_SERVER_IP
Open your favorite VNC client (such as RealVNC Viewer or TigerVNC) and connect to:127.0.0.1:5901
FAQ: Frequently Asked Questions
Why do I see a grey screen with a black cursor upon connecting? This happens if your
~/.vnc/xstartupscript lacks execution permissions or contains syntax errors. Ensure you ranchmod +x ~/.vnc/xstartupand verify that the lineexec dbus-launch --exit-with-session startxfce4is present.How does VNC differ from RDP? RDP (Remote Desktop Protocol) transmits native UI rendering commands and is optimized for lower network bandwidth. VNC transmits raw screen pixel bitmaps. For Linux environments, VNC is highly versatile, and pairing it with Xfce ensures rapid responsiveness.
Can I change the screen resolution on the fly? In the service file (
/etc/systemd/system/[email protected]), resolution is set via the-geometry 1920x1080parameter. You can lower it to1280x720to reduce network throughput or use VNC clients that support dynamic RANDR resizing (such as TigerVNC).
Conclusion
Configuring a VNC server converts a standard terminal-only VPS into a cloud desktop workstation accessible 24/7. Combining the lightweight Xfce environment, TightVNC, and an encrypted SSH tunnel guarantees high performance, low RAM consumption, and total data protection.
For smooth visual desktop streaming, high single-core CPU performance, fast NVMe disk access, and low network latency are essential.
If you are looking for a reliable server to host your remote desktop environment, check out NVMe Cloud VPS options from MivoCloud. Our platform—powered by pure KVM virtualization, high-frequency processors, Enterprise NVMe drives, and 1 Gbps+ network ports—delivers 24/7 smoothness for all your graphical applications.
Article Author: Anatolie Cohaniuc

