How to Connect via Remote Desktop (RDP) to Ubuntu Linux

|

|

This tutorial guides users on how to connect to Ubuntu 20.04 | 18.04 using the Remote Desktop Protocol (RDP) through open-source software, Xrdp. The post provides a detailed step-by-step installation and implementation process for both Ubuntu Desktop and Servers, alongside clarifications and additional necessary steps needed for a successful connection.

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

Xrdp is an open-source Microsoft Remote Desktop Protocol (RDP) implementation allowing you to control a remote computer graphically.

For several reasons, someone may want to connect to Ubuntu Linux via Remote Desktop Protocol (RDP). One common reason is that it allows users to remotely access their Ubuntu desktop or server from another computer, which can be particularly useful for remote work or troubleshooting.

Additionally, RDP provides a graphical user interface (GUI) for Ubuntu, which can be more user-friendly for some users who are not as familiar with the command line interface (CLI).

Overall, connecting via RDP to Ubuntu can be a convenient and efficient way to remotely access and control Ubuntu machines.

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

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>

Connect from Windows 10

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

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

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

Next, enter your Ubuntu machine account username and password and connect using Xorg.

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

That’s it!

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

Connecting to Ubuntu Servers

Since servers generally don’t have a graphical interface, you will need to install a minimal one 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 a firewall enabled out of the box, there is no need to worry about firewall blocking connections.

However, if the Ubuntu firewall is 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 Desktops and Servers.

If you find any error, please report it in the comment form below.

Thanks,

You may also like the post below:

Like this:



22 responses to “How to Connect via Remote Desktop (RDP) to Ubuntu Linux”

  1. Andrew Avatar
    Andrew

    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. Andrew Avatar
    Andrew

    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. reo Avatar
    reo

    i’ve 2 user, using user 1 open, if i using user 2 RDP can’t open..
    please

  4. Horst Avatar
    Horst

    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. Deali Avatar
      Deali

      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…

      1. Billy Avatar
        Billy

        Make sure that there is no user logged into the system before you use RDP.

        1. James Avatar
          James

          This works, thanks!

  5. Rik Avatar
    Rik

    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.

    1. Philipp Avatar
      Philipp

      same here, I’m still trying to figure out what went wrong.

    2. Philipp Avatar
      Philipp

      my solution was, to only use lower case characters for the user name.

      1. Narul Avatar
        Narul

        Great thanks it worked using lower case user name

        1. Clyde Avatar
          Clyde

          Same here, lower case issue. Now it works, thanks!!

  6. Peter Hagen Avatar
    Peter Hagen

    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.

  7. Eric Lloyd Avatar
    Eric Lloyd

    For those whose windows close within five seconds of opening a session on 20.04, try reducing the color depth in your Windows Remote Desktop Connection client. From the initial window: Show Options > Display > Colors = True Color (24-bit).

    And while I’ve had no joy attaching to existing console sessions, if I close the RDP client without logging out, I get the Ubuntu Lock Screen when I reattach.

  8. Stephen Avatar
    Stephen

    I run remote desktop from Windows 10 Pro to an Ubuntu 18.04.2 box and I have no problems connecting even if I am logged on to the Ubuntu box. The Ubuntu machine has the gnome desktop installed and I use xfce as my desktop over RDP. As it all works fine, I am extremely wary of upgrading to 20.04.1. Reading the comments here means I will be staying put on 18.04.2 for some time still. Life is too short to be fire fighting RDP connection issues.

  9. cmcanulty Avatar
    cmcanulty

    I also had no issues with 18.04. 20.04 is an unmitigated disaster numerous fixes and nothing connects either vnc or rdp

  10. Tom Avatar
    Tom

    Confimed not working. Ubuntu 20.04 installs all OK – starts logon window but when you enter the cridentials scren flashes and connection seems to be refused. Need 20.04 resolution here.

    1. Frank S. Avatar
      Frank S.

      After carefully reading the logs, I came across a strange ipv4/ipv6 issue.

      For some reason, the communication between xrdp and sesman was not possible with ipv6 disabled on the loopback interface. When using the address 127.0.0.1, xrdp connected to the ipv6 Link-Local Unicast addresses (like fe80::something) of the eno1 interface (my primary lan network adapter) and got a connection reject. Hence no functional RDP session.

      Only after enabling ipv6 on the loopback interface with
      sysctl -w net.ipv6.conf.lo.disable_ipv6=0
      the xrdp to sesman connection could be established and xrdp was working.

      1. Chris N. Avatar
        Chris N.

        I tried this, but kept getting errors about commands not found, and — “w” not being right.
        ended up having to write “systemctl” and not sysctl, but the “w” being unable is what i’m stumped with.
        Any remedy to this?

        The actual screen it gets stuck on is:

        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

        Please note I have a reaspberry pi running raspbian I am able to remote into no problem.

      2. Michael Avatar
        Michael

        Ill been struggling with this for 6 hours today, and finally now it works!

        I need to allow ipv6 on lo in the future 🙂 Thanks!

  11. Colin Avatar
    Colin

    Hi,
    Logon with lower caps letters worked well, but when trying to access the attached USB soundcard, the system doesn’t have one.
    I want to start a program on the remote machine, analyzing audiosignals and just want to sneak a peek, if there’s some signal.

    Any idea, how i can access to the remote PC and start the application which analyses the audio?!

  12. JayT Avatar
    JayT

    Although the connection is working for me but the problem I am having is to keep entering the 23 characters password everytime I try to connect. the password requirement is on XRDP and I don’t know why Windows RDP app isn’t sending the credentials automatically. Does anybody know of the reason?

    I have a Oracle Cloud before where it was connecting automatically because the IP and the password were stored in Windows RDP app but Oracle terminated my that account so I created a new account using a new credit card and so the problem arose. I want to sort this out to make my life easier because the password I use is quite complex.

Leave a Reply to Billy Cancel 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.