How To Get A Remote Desktop A Headless Server

I recently needed to run an application that was GUI only on a remote, headless server. After I messed with X-Forwarding for long enough to get really frustrated (which wasn’t long) I figured out how to get a desktop running running that I could log into and run the app.

Here’s how.

First, SSH into your server and install the tightVNC server and the Xfce desktop. On Ubuntu 20.03 and Debian 10 the following command will install these for you:

sudo apt-get install tightvncserver xfce4 xfce4-goodies

This will install a lot of dependencies (~750) so be prepared for a few extra packages to get installed!

Next, this file, ~/.vnc/xstartup, needs the following contents:

xrdb $HOME/.Xresources
startxfce4 &

Then, start the VNC server:


Supply the login password when prompted and you’re all ready to log in.

I’ve had a lot of luck with the Remmina remote desktop client. Install it on your local system, choose VNC as the protocol and then set IP:5901 as the server to log into.