How to Connect via Remote Desktop (RDP) to Ubuntu 20.04 | 18.04

This brief tutorial shows students and new users how to connect to Ubuntu 20.04 | 18.04 via Remote Desktop Protocol (RDP).

In some cases, you may want to connect to Ubuntu desktop via remote desktop using existing protocols. At this moment, it’s pretty easy. Simply install few packages and you’re ready to go.

Xrdp is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to graphically control a remote computers.

It provides a fully functional Linux terminal server, capable of accepting connections from rdesktop, freerdp, and Microsoft’s own terminal server / remote desktop clients.

When you’re ready, follow the steps below to get it working.

Step 1: Install Xrdp

Since you already have a desktop environment with Ubuntu Desktop edition, simply run the commands below to Xrdp.

sudo apt update
sudo apt install xrdp
sudo systemctl enable xrdp

To validate that Xrdp is installed, run the commands below:

sudo systemctl status xrdp

That should display similar text as below:

xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: >
Active: active (running) since Tue 2020-04-28 10:11:52 CDT; 15s ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Main PID: 2989 (xrdp)
Tasks: 1 (limit: 4657)
Memory: 1.0M
CGroup: /system.slice/xrdp.service
└─2989 /usr/sbin/xrdp
Apr 28 10:11:51 ubuntu2004 xrdp[2986]: (2986)(140239724779328)[INFO ] address [>
Apr 28 10:11:51 ubuntu2004 xrdp[2986]: (2986)(140239724779328)[INFO ] listening>

Step 2: Connect from Windows 10

Now that Xrdp server is installed,  go and open Windows Remote Desktop Connection app and connect to the desktop hostname or IP address.

Please make to logout of your current Ubuntu desktop sessions. You can’t be logged in to Ubuntu while connecting via Xrdp.

Xrdp Ubuntu setup

When you have logged out of Ubuntu desktop sessions, click Connect to initiate RDP connection. You’ll be prompted for your Ubuntu login details.

Next, type in your Ubuntu machine account username and password and connect using Xorg

xrdp ubuntu setup

When your account username and password are confirmed, you should be logon to your Ubuntu machine from Windows.

That’s it!

Connecting to Ubuntu desktop is easy, since it already has a desktop environment.

Connecting to Ubuntu Servers

Since servers generally don’t have graphical interface, you will need to install a minimal graphical interface for this to work in a server environment.

Run the commands below to install some necessary packages.

sudo apt update
sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils

Next, xrdp user to the sss-cert group by running the commands below:

sudo adduser xrdp ssl-cert

That should get Xrdp installed and ready for connection on Ubuntu servers.

Since most Ubuntu servers don’t have firewall enabled out of the box, no need to worry about firewall blocking connections.

However, if you have Ubuntu firewall enabled, simply run the commands below to allow RDP traffic.

For example, if you’re connecting 192.168.1.0/24 network, then run the commands below:

sudo ufw allow from 192.168.1.0/24 to any port 3389
sudo ufw allow 3389

That’s it!

Conclusion:

This post showed you how to connect via Remote Desktop Protocol (RDP) to Ubuntu 20.04 | 18.04 Desktop and Servers.

If you find any error above, please use the comment form below to report it.

Thanks,

You may also like the post below:

8 thoughts on “How to Connect via Remote Desktop (RDP) to Ubuntu 20.04 | 18.04

  1. Hey there, I’ve installed this on a Ubuntu 20.04 VM inside of Proxmox. It was working just fine until it seems, I rebooted the VM. I get errors now:

    ~$ sudo systemctl status xrdp
    ● xrdp.service – xrdp daemon
    Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Thu 2020-05-07 17:07:24 PDT; 25min ago
    Docs: man:xrdp(8)
    man:xrdp.ini(5)

    May 07 17:07:24 Ubuntu-VM systemd[1]: Starting xrdp daemon…
    May 07 17:07:24 Ubuntu-VM systemd[1]: xrdp.service: Control process exited, code=exited, status=1/FAILU>
    May 07 17:07:24 Ubuntu-VM systemd[1]: xrdp.service: Failed with result ‘exit-code’.
    May 07 17:07:24 Ubuntu-VM systemd[1]: Failed to start xrdp daemon.
    lines 1-10/10 (END)

  2. Seems my last comment did not get posted:

    xRDP is not working after (i think) I rebooted my Ubuntu 20.04 VM machine inside of Proxmox. Errors:

    ~$ sudo systemctl status xrdp
    ● xrdp.service – xrdp daemon
    Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Thu 2020-05-07 17:07:24 PDT; 25min ago
    Docs: man:xrdp(8)
    man:xrdp.ini(5)

    May 07 17:07:24 Ubuntu-VM systemd[1]: Starting xrdp daemon…
    May 07 17:07:24 Ubuntu-VM systemd[1]: xrdp.service: Control process exited, code=exited, status=1/FAILU>
    May 07 17:07:24 Ubuntu-VM systemd[1]: xrdp.service: Failed with result ‘exit-code’.
    May 07 17:07:24 Ubuntu-VM systemd[1]: Failed to start xrdp daemon.
    lines 1-10/10 (END)

  3. if i install 18.04 it works immediatly,
    if i install 20.04 it never works.
    I tried many things
    If i open Remote Desktop on the PC the login screen appears,
    i log in to Xorg screen, the screen is light blue and the turns to black and 2 seconds later it disappear.

    1. i get the same problem.
      I install 18.04 and i can use Remotedesktop,
      i install 20.04 on the same system it will not work at all…

  4. Connecting from my win 10 laptop to a ubuntu 20.04 desktop on the sane wired network. Using cat6a, linksys router and netgear hub.
    I always get:
    “Connection Log
    connecting to sesman ip 127.0.0.1 port 3350
    sesman connect ok
    sending login info to session manager, please wait …..
    login failed for display 0”
    I would love this to work so I can use the linux machine.

  5. Interestingly I get a black screen when the user is already logged in. It seems it can’t connect to an existing session (or create a new one). I first thought it was an issue with wayland (on Fedora I couldn’t use xrdp due to wayland, but when I disabled it, it did work), but in case of Ubuntu 20.04 it does work with wayland. When the user is not logged in, xrdp does work for me. When I’m signed in with xrdp, I can’t sign-in with the same user locally.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.