remote desktop cover for ubuntu
5–8 minutes

Remote Desktop on Ubuntu from Windows: Guide and Setup xrdp

TheRemote Desktop Protocol (RDP)is an essential technology that allows users to establish secure connections and manage computers remotely through a local network or Internet.Originally developed by Microsoftfor its operating systems, the RDP protocol is now widely supported and can be successfully used to interface with devicesLinux, macOS, Android and iOS.

Basic requirements

  • A client computerWindowswith a stable network connection.
  • A host machine with operating systemUbuntu 22.04orUbuntu 20.04already installed and configured.
  • Privileges ofSouthor root access on the host machine to install the necessary packages.

How to Install xrdp on Ubuntu

The packagexrdpis an open source RDP server for Linux environments that can listen and accept connection requests from external clients. Since Ubuntu distributions do not include this default utility, you must proceed with its manual installation. To install xrdp on Ubuntu 22.04, follow these steps:

1. Access the command line of the server (Terminal) and update the list of Ubuntu software packages:

sudo apt update

2. Proceed with xrdp installation using the following command:

sudo apt install xrdp -y
Ubuntu terminal during upgrade apt and installation of xrdp server package

3. Check that the xrdp server service is active and running correctly:

sudo systemctl status xrdp
Active status verification and running of xrdp service on Ubuntu via systemctl

Configure the xrdp Door (Optional but Recommended Action)

By default, the xrdp server receives input RDP connections on thedoor 3389. Choosing to use a non-standard port for Remote Desktop is a protection practice known as“security through obscurity”(security by secrecy). While not an infallible defensive measure, changing the door effectively contributes to deviating and mitigating the rudimentary automated brute force attacks from the web.

To educate xrdp to keep listening on a door other than the default one:

1. Uses a terminal text editor, asnano, to open and edit the main configuration file (xrdp.ini):

sudo nano /etc/xrdp/xrdp.ini

2. Identify the door directive in the section[Globals]and set the new desired numerical value. In our example, we will check the RDP 49952 port:

port=49952
Edit xrdp.ini configuration file to change the default RDP port on Linux

3. PressCtrl+, typey(to confirm) and finally awardsEnterto save the changes and close the nano editor.

4. Restart the xrdp server service to make the new settings just saved:

sudo systemctl restart xrdp

Note: The terminal will not return any confirmation or output message if the service restart is successful.

Configure the UFW Firewall for RDP Traffic in Input

To ensure remote access, it is essential to check that the security system does not block the connection. On a Ubuntu system it is generally activeUFW (Uncomplicated Firewall). You will need to configure the rules of this firewall to explicitly authorize traffic on the designated port and allow the proper handshake RDP.

1. Check the current status of the ufw firewall:

sudo ufw status
UFW firewall status control on Ubuntu before enabling RDP ports

If the firewall status is inactive (inactive), use the following command to turn it on:

sudo ufw enable

2. Allow incoming TCP traffic on port 3389, or on the custom port you chose for xrdp. The underlying command enables connections for the 49952 port we have set previously:

sudo ufw allow 49952/tcp
UFW Command to allow TCP traffic to enter the custom RDP port

(Be sure to change the number in the command if you opted for a different RDP port).

3. Reload the ufw firewall tool rules to instantly apply new directives:

sudo ufw reload
Reloading UFW firewall security rules on Ubuntu terminal

If you need to reach your Ubuntu station from an external network to the local network (e.g. from outside office or home), remember that you will need to configure thePort Forwarding (Flat forward)on your main router or update the policies of any hardware firewalls.

Launch Remote Desktop Connection from Windows to Ubuntu

Once the server is prepared, this is how to start a RDP connection to your Ubuntu system directly from a Windows client:

  1. Typerdpin the search box on the Windows application bar.
  2. Open native application calledRemote Desktop Connection.
    Open Remote Desktop Connection app via search bar on Windows
  3. In the fieldComputer, enter the local IP address (or host name) of the remote Ubuntu system. If you have changed the default listening port in the previous steps, you will have to specify it by joining the IP in this format:Address IP:number port(ex. 192.168.1.50:49952).
  4. In the fieldUsername, type the Ubuntu user account associated with which you want to authenticate.
    Entering IP address and username in Windows Remote Desktop Connection client
  5. (Optional)Click “Save Name” to store session details in the form of linked files, useful for future quick access.
  6. (Optional)Expanding the “Show Options” menu, the Windows client allows you to refine RDP performance according to your band. The settings are divided into various tabs:
    View:To adjust screen resolution and color depth of remote desktop window.
    Local resources:To map and share hardware devices of your local machine (keyboards, microphones, audio, printers or USB flash drives) with the Ubuntu system.
    Experience:To disable unnecessary visual effects like desktop backgrounds and animations, improving fluidity on slow connections.
    Advanced:To manage network-level server authentication and RDP Gateway configurations.
  7. Click the buttonConnected.

Access and Login in the Linux environment

In the first attempt to connect the xrdp system login screen will appear. Enter your Ubuntu user password and click onOKto proceed.

Graphical xrdp login screen for remote Ubuntu user authentication

Congratulations! Now you have total control of your Ubuntu machine’s graphic desktop environment (GUI), managing it comfortably from your Windows station via RDP session.

Viewing Ubuntu desktop interface successfully uploaded to Windows via RDP

Tips for Optimizing RDP Ubuntu Connection from Windows

Internet speed and Latitude:In order for the Remote Desktop experience to be smooth, a stable connection is required. In addition to the bandwidth (which affects graphic rendering), keep an eye on network ping/latency and server CPU load, parameters that deeply affect the response times to click and typing.

Solve the “Black Screen” of xrdp on Ubuntu:Many administrators stumble into an annoying black screen after successfully logging through xrdp. This graphic hitch typically occurs if the user with whom you try to log in already has an active session open locally on the Ubuntu machine. The Ubuntu Desktop Environment (like GNOME) does not support simultaneous graphical user sessions for the same account.Solution:be sure to do the user’s physical logout on the Ubuntu station before initializing the RDP connection from Windows.

Frequently Asked Questions (FAQ) on the Ubuntu Remote Desktop

What is xrdp and why do I need it on Ubuntu?

xrdpis an open-source and free implementation of Microsoft’s Remote Desktop protocol. Since Linux operating systems communicate natively through protocols such as SSH or VNC, xrdp acts as a “bridge”, allowing native Windows clients (or other compatible RDP apps) to visually hook to the graphical desktop environment of Ubuntu natively and responsively, without installing heavy third-party client software on Windows.

Changing port 3389 makes my server completely secure?

No. Changing the default RDP port is a basic technique of “offuscation” that only rejects most bots and automated scripts that passively scan the web in search of door 3389 open. To ensure a corporate security level and avoid intrusion, we strongly recommend encapsulating RDP traffic within a networkVPN (Virtual Private Network)or a SSH encrypted tunnel, alongside two-factor authentication (2FA).

Can I share the clipboard (copy and paste) between Windows and Ubuntu in RDP?

Absolutely. The xrdp protocol automatically manages the bidirectional sharing of notes. If it doesn’t work, make sure that before starting the session, the “Appunti” option (Clipboard) is checked within the tabLocal resourcesbetween Windows Remote Desktop Connection App Advanced Options.

EnglishenEnglishEnglish