Sometimes you need a real graphical desktop environment on your cloud server: to run GUI applications, test software visually, or just prefer working in a desktop interface rather than a terminal. This guide covers two approaches: RDP (using xRDP, the standard remote desktop protocol supported natively by Windows and macOS) and VNC (more universal, works from any OS with a VNC viewer).
I use a remote desktop on a cloud server primarily for running GUI-based tools that don't have headless alternatives — browser automation testing, certain design tools, and the occasional GUI database client.
I run this on Tencent Cloud Lighthouse. The 2 GB RAM / 2 vCPU plan handles XFCE desktop; 4 GB for full GNOME or KDE. Lighthouse complements a remote desktop setup in a practical way: OrcaTerm gives you browser-based terminal access as a fallback if the RDP/VNC connection has issues, so you're never completely locked out. The static public IP also means your RDP client always connects to the same address, and the console-level firewall lets you restrict desktop access to specific IP ranges for security.
- Key Takeaways
| Feature | RDP (xRDP) | VNC |
|---|---|---|
| Protocol | Microsoft RDP | VNC/RFB |
| Client on Windows | Built-in (Remote Desktop) | Needs VNC viewer |
| Client on macOS | Microsoft Remote Desktop (free) | Many options (RealVNC, TigerVNC) |
| Client on Linux | Remmina, freerdp | Many options |
| Client on iOS/Android | Microsoft RD (free) | VNC Viewer |
| Performance | Better (adaptive compression) | Moderate |
| Security | SSL/TLS by default | Needs tunneling for security |
| Audio support | Yes | Limited |
Recommendation: Use xRDP if you connect from Windows or macOS — it's smoother and clients are pre-installed. Use VNC if you need maximum compatibility or connect from unusual platforms.
| Requirement | Details |
|---|---|
| Server | Ubuntu 22.04, 2 GB+ RAM |
| Desktop environment | XFCE (lightweight) or GNOME/KDE |
| Open port | 3389/tcp (RDP) or 5901/tcp (VNC) — via SSH tunnel only |
sudo apt update
sudo apt install -y xfce4 xfce4-goodies
sudo apt install -y ubuntu-desktop-minimal
sudo apt install -y lxde
For most cloud server use cases, XFCE is the right choice — it's responsive, stable, and doesn't consume excessive resources.
sudo apt install -y xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp
Create a session file for the ubuntu user (or your user):
echo "xfce4-session" > ~/.xsession
chmod +x ~/.xsession
Configure xRDP's startup script:
sudo nano /etc/xrdp/startwm.sh
Add at the top (before the test commands):
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
This prevents a common black screen issue.
Restart xRDP:
sudo systemctl restart xrdp
sudo ufw allow from YOUR_LOCAL_IP to any port 3389
sudo ufw reload
Security note: Don't open port 3389 to all IPs (0.0.0.0/0). Either restrict to your IP or use an SSH tunnel (covered in Part 5).
Also open the port in your Lighthouse console firewall with the same IP restriction.
sudo apt install -y tigervnc-standalone-server tigervnc-common
vncpasswd
# Enter and confirm a VNC password
# When asked "Would you like to enter a view-only password?" → No
mkdir -p ~/.vnc
nano ~/.vnc/xstartup
#!/bin/bash
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4
chmod +x ~/.vnc/xstartup
vncserver :1 -geometry 1920x1080 -depth 24
This starts a VNC server on display :1 (port 5901).
Check it's running:
vncserver -list
Create /etc/systemd/system/vncserver@.service:
sudo nano /etc/systemd/system/vncserver@.service
[Unit]
Description=VNC Server for display %i
After=syslog.target network.target
[Service]
Type=simple
User=ubuntu
PAMName=login
PIDFile=/home/ubuntu/.vnc/%H%i.pid
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver %i -geometry 1920x1080 -auth /home/ubuntu/.Xauthority
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable vncserver@:1
sudo systemctl start vncserver@:1
Win + R, type mstscYOUR_SERVER_IP:3389ubuntuYOUR_SERVER_IP:3389ubuntu and your passwordInstall Microsoft Remote Desktop (iOS) or RD Client (Android), same setup.
Download a VNC viewer:
Connect to: YOUR_SERVER_IP:5901
Enter your VNC password when prompted.
Never expose RDP (port 3389) or VNC (port 5901) directly to the internet. These ports are constantly attacked by brute-force bots.
The secure approach: access via SSH tunnel.
On your local machine (Mac/Linux):
ssh -L 3389:localhost:3389 ubuntu@YOUR_SERVER_IP -N &
Then connect your RDP client to localhost:3389 instead of the server IP.
On Windows (using PowerShell):
ssh -L 3389:localhost:3389 ubuntu@YOUR_SERVER_IP -N
Then mstsc /v:localhost:3389.
ssh -L 5901:localhost:5901 ubuntu@YOUR_SERVER_IP -N &
Connect VNC viewer to localhost:5901.
After setting up SSH tunneling, remove direct port access:
sudo ufw delete allow 3389/tcp
sudo ufw delete allow 5901/tcp
Now remote desktop access only works through an SSH tunnel, which is encrypted and authenticated with your SSH key.
After connecting via xRDP, I got a grey screen with only a mouse cursor — no desktop loaded. The cursor moved but nothing appeared.
This is a common xRDP issue caused by session conflicts. It happens when:
.xsession file isn't read correctlyMulti-step fix:
First, kill any existing sessions:
# On the server via SSH
sudo pkill xfce4-session
sudo pkill Xorg
Second, ensure the ~/.xsession fix is applied:
echo "xfce4-session" | tee ~/.xsession
chmod +x ~/.xsession
Third, add the environment variable unset to /etc/xrdp/startwm.sh:
sudo nano /etc/xrdp/startwm.sh
Add at the very beginning:
#!/bin/sh
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
Fourth, restart xRDP:
sudo systemctl restart xrdp
Reconnect — you should now get a full XFCE desktop.
| Issue | Likely Cause | Fix |
|---|---|---|
| Grey/black screen in RDP | Session conflict | Kill existing sessions; check startwm.sh |
| Connection refused | Port not open or wrong port | Check UFW and Lighthouse firewall; verify service is running |
| Login fails | Wrong credentials | Use your Ubuntu user's password, not a new password |
| VNC display resolution wrong | Resolution not set | Set -geometry 1920x1080 in vncserver command |
| Desktop loads but very slow | High latency or low bandwidth | Use RDP (better compression); try lower resolution |
| Can't install apps via GUI | Missing display variable | Set DISPLAY=:1 for VNC or DISPLAY=:10.0 for RDP sessions |
| Font rendering looks wrong | Missing fonts | sudo apt install fonts-dejavu fonts-liberation |
✅ What you set up:
A remote desktop on a cloud server is particularly useful for running graphical applications, browser automation, or visual testing without needing a powerful local machine.
Is self-hosted remote desktop suitable for production use?
Yes — remote desktop is used in production environments ranging from individual developers to small teams. Pair it with regular Lighthouse snapshots and stay current with updates.
How do I migrate from a cloud-hosted remote desktop to self-hosted?
Export your data from the cloud service, import it to the self-hosted instance, update DNS or internal service configurations, and verify everything works before switching fully.
How much disk space does remote desktop need?
Initial installation is minimal. Disk usage grows with usage — artifacts, repositories, and caches accumulate over time. Monitor with df -h and use CBS cloud disk expansion when needed.
How do I set up backups for remote desktop?
Use Lighthouse snapshots for full-server recovery. Additionally, export remote desktop's application data directly (usually a backup command or data directory export) for granular restore capability.
👉 Get started with Tencent Cloud Lighthouse
👉 View current pricing and launch promotions
👉 Explore all active deals and offers