Feb 2, 2013

How to install xrdp on Ubuntu 12.04 Precise Pangolin

I absolutely love a system that can stay connected! With Ubuntu GNU/Linux, there are many ways to get connected remotely to your computer and get your Linux on!

For instance, here is a list of several ways you can stay connected:
Desktop Sharing (built-in VNC, see help)

FreeNX (requires install)
NX Free (requires install)
ssh -X (requires install and local xserver)


The default "Desktop Sharing" functionality in Ubuntu 12.04 is good for some things, but since it's based on VNC, and doesn't have any additional layer for security, it's not a necessarily secure method for connecting to remote machines. Also, people trying to connect from their windows systems will have to obtain/install a vnc client to use for connection. This can be a problem in some environments.

This is where xrdp comes in. xrdp.org is free open source software that can be easily installed in Ubuntu 12.04 GNU/Linux machine via the package management system. Since it uses the RDP protocol, xrdp is a relatively secure method of connection. Other benefits are that your windows users can easily connect with their built-in remote desktop client mstsc.exe and your Linux users with rdesktop.
 
In this post I'm going to outline how to quickly install the xrdp packages and connect with mstsc.exe(windows) or rdesktop(GNU/Linux.

1.)  Enable the community repository in Ubuntu - click to open the "Ubuntu Software Center". Then, on the top menu(top of screen), click Edit > Software Sources > put a checkmark by "Community-maintained free and open-source software (universe)", then click Close.

2.) Update your sources and install xrdp using apt-get. Open the terminal with ctrl+alt+t, then type or paste these commands, hit enter, authenticate, then confirm to install the xrdp packages.

  sudo apt-get update && sudo apt-get install xrdp

Note: Depending on how quickly your machine can update the sources, the sudo apt-get update command may fail after closing the Ubuntu Software Manager because there may be a process running that is updating the sources already in the background. If this happens, wait longer, then try the command again.

3.) Add this special .xsession file entry into the /home/(username) directory you intend to login with (e.g., /home/shannon/.xsession) to improve performance by converting your session to ubuntu-2d:

  echo "gnome-session --session=ubuntu-2d" > /home/YOURUSER/.xsession

4.) Reload the configuration into the xrdp server process:

  sudo /etc/init.d/xrdp restart

That's it. Now you can connect to your xrdp host with ease from GNU/Linux using:

 rdesktop ip-or-host-of-your-xrdp-server


Or from windows, with:

  windows-key+R, mstsc.exe /v:ip-or-host-of-your-xrdp-server


Tip: If you find that you're having problems changing network settings via your xrdp session, it's because of the protection configured to secure the machine to console users only via policy-kit.

See this article for more information and a workaround:
http://ubuntuforums.org/showpost.php?s=d9ba0898e67cf91204ecc75f693ed4ed&p=10095159&postcount=3

Spoiler: Basically you're modifying all "no" values in the allow_inactive attributes to "yes" in
/usr/share/polkit-1/actions/org.freedesktop.network-manager-settings.system.policy


Cheers!
Shannon VanWagner

02-03-2013