Microsoft Remote Desktop Ubuntu



  1. Mar 27, 2020 The easiest option is to use Remote Desktop Protocol or RDP. Built into Windows, this tool can establish a remote desktop connection across your home network. All you need is the IP address of the Ubuntu device. While the necessary software is pre-installed on Windows, you'll need to install the xrdp tool on Ubuntu.
  2. Jun 26, 2020 Remote Desktop (Xrdp) is a free and open-source implementation of the Microsoft RDP server that enables operating systems other than Microsoft Windows to provide a fully functional RDP-compatible remote desktop experience. This tutorial will explain to you how to install and configure the Xrdp on Ubuntu 18.04.

Step 2: Launch the Remmina Remote Desktop Client. By default, Ubuntu comes with a remote desktop client app that supports the Remote Desktop Protocol (RDP) used by Windows operating systems for remote connections. You can find it in Ubuntu’s Apps list. 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.

Virtual Network Computing (VNC) is a protocol commonly used to share a graphical desktop over a network. Popular uses for VNC include technical support and screen sharing.

Microsoft Remote Desktop Ubuntu

By default, Ubuntu comes with Remmina remote desktop client with support for VNC and RDP protocols. We will use it to access remote server.

What you’ll need

  • A computer running Ubuntu 16.04 LTS or above
  • A running VNC server
  • Remmina Remote Desktop Client installed

Installing Remmina

If you don’t have Remmina on your Ubuntu installation, install it with sudo apt install remmina remmina-plugin-vnc. You can also use snap package (sudo snap install remmina).

Originally authored by Marcin Mikołajczak.

Learning has never been so easy!

The following explains the basics on successfully establishing a connection from a Windows machine to Ubuntu 14.04 (trusty tahr) using Remote Desktop Connection. To do this right, your Ubuntu machine will need xrdp software, and a user account with group membership to tsusers (this is an xrdp specific group). Some additional configuration will be required when setting this up, so it is recommended that you have a second user account with which to perform your configuration on the remote desktop account.

12 Steps total

Step 1: Download XRDP for Ubuntu:

Microsoft Remote Desktop Ubuntu

sudo apt-get install xrdp

Step 2: Install your desktop environment (in this case, xfce4):

Since gnome is no longer supported by XRDP sessions, you must utilize a lighter desktop environment for use with XRDP (xfce4 works very well).

sudo apt-get install xfce4

Microsoft

Step 3: Associate XRDP to use the newly installed desktop during a session (otherwise you will see a grey screen with an ‘X’ as your cursor):

echo xfce4-session >~/.xsession

Step 4: For good measure, it is a good idea to edit the startwm.sh file to ensure that XRDP will always use xfce4:

sudo vim /etc/xrdp/startwm.sh

Add the following lines at the end of the file:
. /etc/X11/Xsession
. /usr/bin/startxfce4

Step 5: Edit the xrdp.ini file so that the proper port, username and password are used by XRDP:

Desktop

By default, XRDP will open new instances of a session upon each login. These instances will also utilize unique port numbers. To avoid mirroring sessions over multiple ports, the port number must be statically identified at the XRDP login screen (this can be done within the xrdp.ini file).

To edit this file, type:
sudo vim /etc/xrdp/xrdp.ini

At the end of the [xrdp1] code block, there is a line for defining the port number value. We are only concerned with the [xrdp1] block, as it contains default values for sesman-Xvnc type connections. By default, the port value is -1 which instructs the XRDP session to search for a newly available port on which to open the connection. We want to be able to specify the port at login. We also want to be able to specify the username and password (IP should be left at the loopback address). The bottom four lines of our code block for [xrdp1] should now read:

a. username=ask
b. password=ask
c. ip=127.0.0.1
d. port=ask -1

By changing the port to “ask -1” we instruct XRDP to prompt the user for the port number at login, and autofill its value to -1 (this is important and is needed for your first RDP login).

Step 6: Save the file and restart the XRDP service:

sudo service xrdp restart

Microsoft Remote Desktop Ubuntu 18 04

Step 7: Add the XRDP user account to the 'tsusers' group:

Before attempting our initial login, we need to make sure that the user account that is to be used is a member of the tsusers group (this is a group created by XRDP program).

sudo usermod –a –G tsusers ‘username’

Step 8: Start RDC from your windows machine:

Now you are ready to open your first connection using Remote Desktop. For the IP, we want to type the IP of your Ubuntu machine (should be the eth0 IP).

Step 9: Enter your XRDP login info:

You will now be prompted for your XRDP login info. Enter the username and password of the user that was added to the ‘tsusers’ group. For this login, leave the port at its default value (-1).

Step 10: Write down which port number was opened by XRDP:

Microsoft Remote Desktop Ubuntu Free

For our first login, we want the port to remain at -1. This will allow XRDP to open up a port for us to use during later logins. BE READY TO WRITE DOWN THE PORT NUMBER FOR REFERENCE LATER ON. Your initial XRDP login will print the port number on screen briefly, so have a pen and paper ready.

Step 11: Add the newfound port number to your xrdp.ini file:

After a successful log in is made, it is imperative that this port number be added to the xrdp.ini file in place of the -1 value (so you do not forget which port your session is on). In this case, it should now read:

port=ask 5911

Now we are free to disconnect from our running session, and reconnect via this port to find all of our programs up and running as we left them.

Microsoft Remote Desktop Assistant

Step 12: Troubleshooting XRDP connections that are in an error state:

Note that if connected to an XRDP session, “logging out” of the xfce4 desktop in Ubuntu will not terminate the XRDP remote session, but rather it will leave your session in a state of limbo with no way of dropping to the terminal to recover your interface (you will see a grey screen with an ‘X’ for a cursor). Establishing new XRDP connections over the same port will not remedy this malfunction either, so in order to kill the connection without restarting Ubuntu, the following must be done:

a. The user session must be deleted
b. All processes running for that user must be killed

To delete the user session (in our case on port 5911), we navigate to the following directory:

/tmp/.X11-unix

From this directory, we can view all running Xsessions and their users by typing:
ls –l

There will always be a root session running on X0. DO NOT KILL THIS SESSION. We are only concerned with our limbo session, which in our case should appear on X11. (This number may differ depending on the port that was used). To kill the session, type the following:

sudo rm X11

Now we need to kill all running processes for our user account. To view running processes for a user account, type:

top –U ‘username’

Windows Remote Desktop Ubuntu 20.04

Your session should now be freed from its limbo state! Even though our Xsession was killed, a new port does not need to be discovered with the -1 value. Instead we can continue to use the port number from before (5911).

References

Microsoft Remote Desktop For Ubuntu

  • Deleting 'orphaned' XRDP sessions
  • How to install xrdp in Ubuntu 14.04
  • How to set up xrdp to reuse an existing session.
  • Ubuntu 14.04 LTS xrdp grey screen

4 Comments

  • Pimiento
    robbytaylor Apr 30, 2015 at 07:19pm

    Thank you for sharing this information.
    i had the one issue with my Ubuntu 14.04 system, that is grey curson with x cursor.
    and i got the best solution for me here....

    http://expertisenpuru.com/how-to-fix-grey-screen-with-x-cursor-problem-in-ubuntu-14-04-or-higher/

  • Pimiento
    spicehead-gmxl8 May 13, 2020 at 05:28pm

    The command above 'sudo usermod –a –G tsusers ‘username’' doesn't work if you cut-and-paste it from the web page into the terminal because the dash appears to be a different character from what Ubuntu is expecting. You need to manually type the dash to get this command to work.

  • Pimiento
    spicehead-gmxl8 May 13, 2020 at 06:37pm

    If at step 7 you get the message 'usermod: group 'tsusers' does not exist',try:
    cat /etc/xrdp/sesman.ini | grep tsusers
    (You should see 'TerminalServerUsers=tsusers')
    Then create the tsusers group with...
    sudo addgroup tsusers

  • Pimiento
    dubla89 Mar 3, 2021 at 06:08pm

    I have been battling to get RDP to work to my Ubuntu VM for-ever. I really want RDP to work because my Hyper-V vm doesn't use my cursor until i have clicked on it, so you then have to be very careful where you click. its very annoying. I just want to get this to work!!!!

    I tried going through this guide as it is slightly different to others I have bee through.

    I had to apply a few fixes along the way but I CANNOT do step 5 because the [xrdp1] block does not exist in my file!?

    i tried continuing anyway but again my RDP window doesn't do anything. my login box vanishes after i enter my login info and i just see the blue background forever. This is the same as it has always been. No error no nothing.

    I also had to create the tsusers group because it was not made automatically.