↓Skip to main content
Alemasone

Remote Desktop from Windows to Ubuntu: Updated Guide

Ubuntu now features a native RDP server. Learn how to enable it, when to use xRDP, and how to fix the black screen issue on your first connection.

7 min read Updated on
Ubuntu desktop displayed inside a Windows Remote Desktop Connection window
On this page
On recent versions of Ubuntu, you no longer need to install xRDP: the RDP server is already included and can be activated via Settings → System → Remote Desktop. From Windows, you connect using Remote Desktop Connection, which you already have. xRDP remains useful on older versions, on headless servers, and with desktop environments other than GNOME.

You will notice the difference: the integrated server works with Wayland, requires no extra packages, and doesn’t suffer from the session issues that caused the infamous black screen with xRDP. Ubuntu 22.04 already allows you to share your screen via RDP; starting with Ubuntu 24.04, you can also use remote access with a dedicated session of your own.

The integrated RDP server #

Open Settings → System → Remote Desktop. If you can’t find it, type “remote” in the settings search (on Ubuntu 22.04, it is located under Settings → Sharing).

There are two modes, and it’s important to understand the difference right away:

ModeWhat it doesPort
Desktop SharingConnects you to the session already open on the computer, as if you were watching its screen3390
Remote DesktopOpens a new and separate session, even if no one is sitting at the computer3389

Desktop sharing is used for providing assistance or resuming work exactly where you left off. Remote desktop is what you should use to work on the computer from afar; additionally, it scales the resolution to your client window, resulting in a sharper image. If you only enable sharing, it usually uses port 3389: check the one shown in the panel.

Remote Desktop panel in Ubuntu settings with the Desktop Sharing and Remote Desktop tabs
Hostname, port, and dedicated credentials are all located on this screen
  1. Toggle the switch for the tab you need.

  2. Make a note of the hostname and port shown in the panel, and set a username and password for the connection. These are credentials specifically for remote desktop, different from the ones you use to log into Ubuntu.

  3. If your firewall is active, open the ports:

    sudo ufw allow 3389:3390/tcp
    sudo ufw reload
    
  4. On Windows, search for rdp in the Start menu and open Remote Desktop Connection. Enter the IP address of the Ubuntu computer—adding :3390 if you are using desktop sharing—and enter the credentials from step 2.

To find the IP address of your Ubuntu computer, type ip a in the terminal and look for line inet of your network interface (which usually starts with 192.168. on most home networks). If it changes every time you reboot, set a static IP in your router settings.

Remote Desktop Connection session from Windows 11 already connected to an Ubuntu 22.04 desktop
Once connected, the Ubuntu desktop appears in a Windows window

From Show Options in the Windows client, you can save the connection to a file .rdp so you can reopen it with a double-click, and adjust resolution, color depth, and shared resources.

When xRDP is still needed #

Three cases where manual installation still makes sense:

  • Older Ubuntu versions that lack the remote desktop panel;
  • Headless servers, where you also need to install a desktop environment;
  • Desktop environments other than GNOME, such as XFCE or MATE, which do not have the integrated server.

The installation requires three commands:

sudo apt update
sudo apt install xrdp
sudo systemctl enable --now xrdp

Check that the service is active using sudo systemctl status xrdp and open the port on your firewall:

sudo ufw allow 3389/tcp

Ubuntu terminal showing the output of systemctl status xrdp with the service marked as active (running)
The line you are looking for is the one containing ‘active (running)’; if it’s missing, the service hasn’t started

If you want to change the xRDP port, open /etc/xrdp/xrdp.ini, edit line port=3389 in section [Globals] (for example, port=49952), restart with sudo systemctl restart xrdp, and open the new port on UFW. In your Windows client, you will then type indirizzo-ip:49952.

The black screen with xRDP #

This is the problem that stops almost everyone on their first attempt: the connection succeeds, but then a black window appears and the connection closes.

The most common cause is that the same user already has an active graphical session open on the computer. With xRDP, you cannot have both a local and a remote session for the same user running simultaneously: log out of your local session (locking the screen is not enough) and try again.

The graphical session fails to start. With xRDP, you must specify which environment to launch by creating a file in your user folder:

echo "gnome-session" > ~/.xsession
sudo systemctl restart xrdp

Wayland. xRDP was built for X11, and results can be hit-or-miss with Wayland. If the problem persists, open /etc/gdm3/custom.conf, remove the hash symbol before line WaylandEnable=false, and restart your computer. You don’t need to do this if you are using the integrated RDP server.

Color and resolution. If the window stays black but the connection doesn’t drop, try lowering the color depth to 16-bit in the Windows client options.

Before wasting hours on an xRDP black screen, check if your Ubuntu has the Remote Desktop panel. Usually, the integrated server works perfectly on the first try and saves you all this trouble.

Connecting from outside your home #

Never open RDP ports directly to the internet: they are among the most targeted by automated attacks.

There are two secure ways:

  • A VPN, such as Tailscale or WireGuard, which virtually places you inside your home network; from there, you connect as if you were actually there;

  • An SSH tunnel, which routes the RDP connection through an encrypted connection. From your Windows computer, using the OpenSSH client already included in Windows 10 and 11:

    ssh -L 3390:localhost:3389 utente@indirizzo-del-server
    

    Then, while keeping that window open, connect via your RDP client to localhost:3390.

If you absolutely must open a port on your router, at least use a different external port, restrict access to authorized IP addresses, and choose long passwords.

RDP {#alternative} alternatives #

VNC is the classic Linux protocol: in some cases it’s easier to set up, but it performs poorly on slow connections and isn’t encrypted by default.

Remote desktop software like RustDesk or AnyDesk routes through their own servers, so you don’t need to open ports or touch your router settings. This is the fastest way when you need to help someone who wouldn’t know how to follow a manual procedure.

SSH alone is enough if you only need terminal access rather than a graphical interface: it’s lighter, more secure, and works over any connection.

FAQ #

Can I use the Ubuntu computer while someone else is connected? #

It depends on the mode. With screen sharing, yes, because you both see the same session: this is specifically designed for remote assistance. With remote desktop access, the session is separate from the local one.

Is the RDP connection encrypted? #

Yes, the protocol encrypts the traffic, but it uses self-signed certificates by default. This is fine on a local network; if you are connecting over the internet, always use a VPN or an SSH tunnel.

Does it work from a Mac or a phone too? #

Yes. Microsoft offers the Windows App (formerly called Remote Desktop) for macOS, iPhone, and Android, and the process is the same: address, port, and remote desktop credentials.

Does copy-pasting between Windows and Ubuntu work? #

Yes, both with the built-in server and with xRDP. If it doesn’t work, before connecting, open Show Options → Local Resources in the Windows client and make sure Clipboard is checked.

Why is the resolution wrong? #

With screen sharing, you see the resolution of the physical Ubuntu screen, which might not match your window size. With remote desktop access, however, it adapts to the client’s dimensions.

The connection is slow: can it be improved? #

Lower the color depth, disable graphical effects, and uncheck clipboard and printer sharing in the client options. On very slow connections, a lightweight desktop like XFCE with xRDP performs better than GNOME.

Read next