Back to article
Setting Up Remote Graphical Desktops on Linux
Setting Up an RDP Server and Client in Linux
December 20, 2010
There are two popular technologies for running remote graphical desktops: Virtual Network Computing (VNC) and Remote Desktop Protocol (RDP). VNC uses the Remote FrameBuffer (RFB) protocol. It's platform-independent and there are open source server and client applications for Linux, Windows, and Mac OS X. The RDP was developed by Microsoft and is the only remote desktop protocol used by default in Windows.
At first glance, using VNC due to its open source benefits, platform-independence, and feature advantages might seem the best. However, RDP might be the best solution, even on Linux machines, if your organization is primarily a Microsoft shop. Installing an RDP server or client on a handful of Linux machines is likely easier than deploying VNC servers and clients on your entire Windows fleet.
In this tutorial, we'll see how to get RDP support in Linux. We'll install a RDP server so Windows users can use the native Remote Desktop Connection client to remotely connect. Then we'll install an RDP client so Linux users can remotely connect to Windows, or other Linux machines.
Setting up the xrdp server
For the server we'll use the open source xrdp server. It displays a new X window instance using Xvnc or X11rdp. Keep in mind the remote user won't see any applications or windows that are opened on the actual desktop. It will appear as a fresh desktop. If you want access to the native desktop session, you can download and use the x0vncserver.
First, search the packages of your Linux distribution for xrdp, and install it and the dependencies with the package manager. Otherwise you can download and manually build for installation.
Once xrdp is installed, it should automatically be ready for clients to connect. However, if you have any firewall installed on the Linux machine, you need to make sure TCP port 3389 is allowed. To connect from outside the host's subnet forward TCP port 3389 on your routers.
If you want to enable remote connections via the Internet to multiple computers on the same network, you'll have to change the port used by the xrdp server for all, or all but one, of your computers. If you have Windows computers accepting remote connections, you'll have to edit the ports for those as well. Remote users can specify the port number for the particular computer they want to connect to, so then the router will know which computer to forward the connection to. Don't forget to open the custom ports you assign with any firewall installed on the host computers. When assigning port numbers, you can just start at the default port 3389 and go on: 3390, 3391, and so on.
To change the default port of xrdp, open the /etc/xrdp/xrdp.ini file as root, edit the port entry in the Global section, and then restart xrdp with the following command as root: /etc/init.d/xrdp restart. Microsoft provides a registry hack to change the default port used by Windows.
Another method to support RDP connections to multiple computers is to install the xrdp server on one Linux machine (with the default port) and then install a regular VNC server on the other computers in the local network, all with the default VNC port. Then when remote users connect via RDP, they'll get the xrdp screen where they can specify a computer's local IP to connect via VNC. This means there would only be one port opened to the Internet, configured on the router.