With Xrdp you can remotely log in on a virtual machine, giving you a full virtual desktop. Moreover, you can close the RDP window and pick up the session later, allowing you to continue to work on a graphical desktop while switching off your own local computer.
First, you need to set up your Linux VM, using the following steps.
The default Unity desktop does not support remote sessions as well as other desktop environments do. To create a virtual machine with a GUI, create a plain server VM and install the desktop environment of your choice, for example KDE or Xfce (which is used in the example below). This following example works under Ubuntu 14.04 server.
sudo su -
ufw allow 3389 ufw allow ssh ufw enable
USERNAME=maarten adduser $USERNAME adduser $USERNAME sudo sudo usermod -aG sudo,adm $USERNAME
sudo apt-get install xrdp xubuntu-desktop tightvncserver apt-get update
echo xfce4-session >~/.xsession
sudo service xrdp restart
Now you can connect to your machine. However, Ubuntu’s default settings are to create a new session each time you log in instead of resuming your old session. Let us fix this.
In the next step you will have to edit a file by using a text editor. For example, you can use
sudo nano /etc/xrdp/xrdp.inito edit the file we will tell you in a moment. To save the changes you can then press the key combination
Ctrl + X(see then that at the bottom of the screen you get a question like Save modified buffer […]?. Press then the
ykey, and finally hit
/etc/xrdp/xrdp.iniand change the items under the
[xrdp1] name=reconnect lib=libvnc.so username=ask password=ask ip=127.0.0.1 port=ask5910
-1for the first session and start your virtual desktop.
5910(default value) and you will continue the previous session.
The following steps describe the procedure for setting up Xrdp in CentOS 6. Other distributions may require some variation, but the guidelines should remain analogous.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3389 -j ACCEPT
reload the firewall configuration, using
service iptables reload
yum install -y tigervnc-server xrdp
chkconfig --levels 5 xrdp on service xrdp start
On newer Fedora-based systems, use
systemctl enable xrdp systemctl start xrdp systemctl enable xrdp-sesman systemctl start xrdp-sesman
You can now log in on the virtual machine using RDP. From Windows or Mac OSX, use the Remote Desktop Connection client, sometimes supplied as an additional package to Microsoft Office. On a Linux desktop, use Rdesktop.
Make sure to set the display to millions of colors (Mac OsX) or high color (16-bits) (Windows), because thousands of colors (Mac OsX) or high color (15-bits) (Windows) will give you a non-descriptive error.
We have a full page on installing Windows, where we explain how serve access to Remote Desktop from it.