A Road Warrior's Companion: Part 8 - A Linux Remote Desktop

A Road Warrior’s Companion: Part 8 – A Linux Remote Desktop

One of the most challenging things about working remotely is that now and again you have a program that lacks a mobile compatible counterpart that you find essential to work with. This will generally lead to the necessity of carrying a laptop around with you everywhere so that you can access that software. Fortunately, most mobile devices do have applications available that will allow them to remotely connect to a computer and allow you to use its desktop environment. With Microsoft Windows servers this is pretty easy as the Windows Remote Desktop system is pretty widely supported, so if you have a Windows VPS this can make life simple on that front. If you are running a Linux VPS then it’s not quite so simple, but it can still be done.

Accessing Your VPS From Your Mobile Device

The first thing we’d need to do with our VPS is install the desktop environment. As a VPS is generally a low resource computer and lacks 3D acceleration, it’s best to use a desktop environment that is optimized for it – in this case we’ll use LXDE. This doesn’t allow remote access on its own though, so we’ll also be installing TightVNC server to allow us to remotely connect and access the desktop on the server. Fortunately everything we need is in the standard repositories for Debian and Ubuntu, so installation is as simple as:

sudo apt-get update

sudo apt-get install xorg lxde-core tightvncserver

The installation may take a little time to complete, and it also takes up a moderate amount of space on the disk (on my test system it used 400MB). Once this is completed, the first thing you need to do is to start TightVNC server.  As TightVNC server will be running as the user who is logged into the desktop environment, you’ll need to make sure that you change to that user account if you aren’t using it already. We strongly recommend you do not run vncserver as root. To start the server run the following command:


This will ask you to provide a password that will be required to log into your desktop session. You will need to remember and use that password when connecting in the future. You will also be asked if you want to set a read-only password, which would allow the screen to be viewed but not interacted with. You can set one if you think you may need that feature, otherwise you can answer no to that question. With the questions answered it will show that it has started a server numbered 1. We’ll need to make some configuration changes for it, so we need to kill this running session with:

vncserver -kill 1

Now we need to edit the configuration file for the session. In this example I’ll be using nano, but you can use whichever text editor you prefer:

nano ~/.vnc/xstartup

At the bottom of the file, below the line that reads “/etc/X11/Xsession”, add the following lines:

lxterminal &

/usr/bin/lxsession -s LXDE &

Save and exit the file, then you can restart the session simply by calling vncserver again:


You should now be able to go to a VNC client on your computer, smartphone or tablet and connect to your server using the server’s IP address or domain name followed by “:1” in the connection bar. You’ll be prompted for the password that you set earlier, after which you should be greeted with your server’s desktop.

If you get a connection refused you’ll likely need to open the port on your firewall. If you are configured as outlined in our previous articles, then the following command will open the VNC server to the world:

sudo iptables -A INPUT -i eth0 -m state –state NEW -p tcp –dport 5901 -j ACCEPT

This install is somewhat bare at the moment, so you’ll probably want to install some of the applications you’d be using with your desktop. To get started you may want to install the Lubuntu Software Center if you are running Ubuntu, as that will make installing other applications a lot easier.

sudo apt-get install lubuntu-software-center

We’re not quite finished yet, though, as at the moment it won’t start automatically if the server is rebooted and your desktop is accessible to anyone round the world. Next time we’ll look at increasing the security and making sure it runs after a reboot.

This article was brought to you by, for dedicated server hosting, cloud servers and 24/7 support visit our site here

No Comments

over 200,000 servers launched

and counting worldwide...