Skip to main content

Command Palette

Search for a command to run...

Setting Up XRDP on Ubuntu Server for Remote Desktop Access

Published
4 min read
A

Hi there! I’m Adarsh, a passionate information science student with hands-on experience in machine learning, software development, and data analysis. I thrive on solving complex problems and enjoy collaborating with teams to bring innovative solutions to life. Whether it’s developing a recommendation engine or streamlining workflows with automation, I love diving into new technologies. I’m always eager to learn and explore fresh ideas, especially in the world of Flutter app development!

If you want to access your Ubuntu server from a Windows machine, using Remote Desktop Protocol (RDP) is a convenient option. In this blog post, we'll walk you through setting up XRDP on your Ubuntu server, allowing you to connect easily from a Windows machine. So, grab your coffee, and let’s get started!

Prerequisites

Before we dive in, make sure you have:

  • An Ubuntu server running.

  • Access to the terminal with sudo privileges.

  • A Windows machine with Remote Desktop Connection.

Step 1: Install XRDP on the Ubuntu Server

First things first—let’s install XRDP. Open your terminal and run the following commands:

1. Update Package List

sudo apt update

2. Install XRDP

Now, install the XRDP package:

sudo apt install xrdp

3. Start and Enable XRDP Service

After installation, you’ll want to start the XRDP service and enable it to run on startup:

sudo systemctl enable xrdp
sudo systemctl start xrdp

4. Check XRDP Status

Verify that XRDP is running correctly:

sudo systemctl status xrdp

You should see an “active (running)” status. If not, something went wrong—don’t panic! Just ensure all previous steps were executed properly.

5. Allow RDP Through the Firewall

If you have a firewall enabled, allow RDP traffic:

sudo ufw allow 3389/tcp

Step 2: Configure a Desktop Environment

XRDP needs a graphical interface to display the desktop. If you haven't installed a desktop environment yet, let's do it now. We'll use XFCE for this guide, as it's lightweight and works well with XRDP.

1. Install XFCE

sudo apt install xfce4

2. Set XFCE as the Default Session

Create or modify your .xsession file to ensure XRDP uses XFCE:

echo "xfce4-session" > ~/.xsession

Step 3: Connect from Windows

Now that everything is set up on your Ubuntu server, let’s connect from your Windows machine.

1. Open Remote Desktop Connection

Press Win + R, type mstsc, and hit Enter. This opens the Remote Desktop Connection window.

2. Enter the Server IP Address

Type the IP address or hostname of your Ubuntu server, then click “Connect.”

3. Log In with Your Ubuntu Credentials

Enter your Ubuntu username and password. If everything is set up correctly, you should see the XFCE desktop environment!

Troubleshooting Common Issues

If you encounter issues connecting or see a blank screen, here are some troubleshooting steps:

1. Check XRDP Installation

Ensure XRDP is running:

sudo systemctl status xrdp

If it's not active, start it:

sudo systemctl start xrdp

2. Install Required Desktop Environment

If you skipped the desktop environment installation, XRDP won’t have anything to display. Install XFCE as shown earlier, and ensure it's configured properly in your .xsession.

3. Check User Permissions

Make sure your user has permission to access XRDP:

sudo adduser xrdp ssl-cert

4. Check Firewall Settings

Ensure your firewall is allowing traffic on port 3389:

sudo ufw status

If it’s not allowed, run:

sudo ufw allow 3389/tcp

5. Review Logs for Errors

Check the XRDP logs for any error messages that can provide clues:

cat /var/log/xrdp-sesman.log
cat /var/log/xrdp.log

6. Session Configuration

Make sure your session is properly configured. Edit the xrdp.ini file:

sudo nano /etc/xrdp/xrdp.ini

Look for the section that starts with [Xorg] and ensure it looks like this:

[Xorg]
param=Xorg
session=xfce

7. Reconfigure XRDP

After making changes, restart the XRDP service:

sudo systemctl restart xrdp

8. Test Different Desktop Environments

If you continue to have issues with XFCE, you could try another desktop environment like LXDE or MATE:

sudo apt install lxde

Then update your .xsession:

echo "startlxde" > ~/.xsession

9. Check for Resource Usage

Ensure your server has enough resources. You can check CPU and memory usage with:

top

10. Reboot the Server

After applying changes, reboot the server to ensure everything is applied correctly:

sudo reboot

Conclusion

You should now be able to access your Ubuntu server remotely using XRDP. This setup allows you to work on your server's GUI applications as if you were sitting right in front of it.

If you run into issues, don’t hesitate to revisit the troubleshooting steps, and remember that the community is here to help! Happy remote accessing!

More from this blog

sangama

1285 posts