Setting up XRDP on Ubuntu

Install XRDP
sudo apt-get install xrdp

Once installed update the xrdp.ini file to set crypt_level=high
sudo vim /etc/xrdp/xrdp.ini

Update the firewall to allow connectivity
sudo ufw allow 3389/tcp

Restart the service to apply changes from config
sudo systemctl restart xrdp

Installing pyautogui on Ubuntu Server

The Issue

I was recently assisting a QA engineer with some #Fun™ problems on Jenkins where tests running pyautogui (running under Python 2.7) were failing because pyautogui was not installed. Every time we attempted to pip install pyautogui it would give an error similar to the following:

Downloading/unpacking pyautogui
Downloading PyAutoGUI-0.9.36.tar.gz (46kB): 46kB downloaded
Running (path:/tmp/pip-build-tbxln81q/pyautogui/ egg_info for package pyautogui
Traceback (most recent call last):
File "", line 17, in
File "/tmp/pip-build-tbxln81q/pyautogui/", line 6, in
File "/tmp/pip-build-tbxln81q/pyautogui/pyautogui/", line 115, in
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-tbxln81q/pyautogui/pyautogui/", line 160, in
_display = Display(os.environ['DISPLAY'])
File "/usr/lib/python3.4/", line 633, in getitem
raise KeyError(key) from None
KeyError: 'DISPLAY'
Complete output from command python egg_info:
Traceback (most recent call last):

File "", line 17, in

File "/tmp/pip-build-tbxln81q/pyautogui/", line 6, in

The Fix

Ensure you have the following packaged installed: xserver-xorg, python-pip, python-xlib, xfce4 (you can use a different desktop env such as Gnome or KDE), and xauth.
sudo apt-get install -y xserver-xorg python-pip python-xlib xfce4 xauth
Also ensure that once you’ve install pip that you upgrade pip by running the following:
pip install --upgrade pip
Open a GUI session either through xrdp (if installed) or console. Once you are here run the following command:
Open an SSH connection to the server and set the $DISPLAY environment variable to match the output of the command above, in my case it was :10.0
export DISPLAY=:10.0
You can confirm this value is set by running the echo command again. Once this is in place run the following to install pyautogui
pip install pyautogui

Other Errors
If you receive any other errors around xauth or xserver try purging and reinstalling the packages above. You may also need to install a few other pip packages such as pillow and xlib.

Guacamole Server For Home Labs

So you’re an IT pro with a home lab, that’s awesome! Except when you aren’t at home and you can’t get to all of your machines that you need to. Exposing RDP or SSH without multi-factor auth is certainly not something I’d recommend. This is where Guacamole comes in incredibly handy. Guacamole is a web based client that allows you to establish RDP, SSH, and Telnet sessions from within the local network. Port forwarding 8080 for Guacamole allows for outside access thus giving you SSH, RDP, and Telnet access on your local network without exposing your entire home lab to the outside internet.

Here’s the install process:

-Setup a Centos 6 or 7 VM with at least 2 cores and a good 4gb or RAM and a small 10gb drive
-run the following commands below (leverages the script to complete the install of Guacamole and all of its dependancies)

Install Wget
yum install wget -y

Wget the install script

chmod the script to make it executable
sudo chmod 755

Run the script
sudo ./

Open a browser and visit the ip or hostname:8080/guacamole

Screen Shot 2016-10-26 at 10.14.41 AM

Once logged in you can see any node groups you created in a tree along with their connections:
Screen Shot 2016-10-26 at 10.14.55 AM

To add additional connections click your username in the top right, choose settings, and then click the connections tab and choose create new connection and fill out the necessary info:

Screen Shot 2016-10-26 at 10.16.51 AM

I’ve been using Guacamole for about 8 months now and it’s great to be able to make changes to my managed switches and access all of my lab machines. I hope this has been a helpful post and that you enjoy Guacamole server!