How to connect to an Ubuntu server via RDP Print

  • rdp, xrdp, ubuntu, remote desktop, linux
  • 29

RDP gives you a graphical desktop rather than a command line. Ubuntu servers are normally installed without a desktop, so two things have to be added before you can connect: a desktop environment and an RDP server.

Consider whether you need this at all. Almost everything on a Linux server is done more quickly over SSH, and a desktop environment consumes memory and processor time permanently. If you only need a graphical session for one specific application, SSH with X11 forwarding is often the lighter answer — see How to connect to a server via SSH.

1. Install a desktop environment

A lightweight desktop works best over a remote connection. Xfce is the usual choice:

sudo apt update
sudo apt install xfce4 xfce4-goodies

GNOME also works but is heavier and, as noted below, needs extra care with xrdp.

2. Install xrdp

sudo apt install xrdp
sudo systemctl enable --now xrdp

Then tell xrdp which session to start for your user:

echo "xfce4-session" > ~/.xsession

Do this as the user you will log in as, not as root. Omitting this step is the most common cause of a black or empty screen after a successful login.

3. Allow the port

If a firewall is active, permit RDP:

sudo ufw allow 3389/tcp

Do not leave port 3389 open to the whole internet. It attracts continuous automated login attempts. Either restrict access to your own address:

sudo ufw allow from YOUR_IP to any port 3389 proto tcp

or leave the port closed and reach it through an SSH tunnel:

ssh -L 3389:localhost:3389 [email protected]

and then connect your RDP client to localhost:3389. The tunnel is encrypted and exposes nothing.

4. Connect

Any RDP client will do. Enter the server's host name — vm00000.sayob.com, where vm00000 is your server's identifier — or its IP address, with your Ubuntu user name and password.

  • Windows — the built-in Remote Desktop Connection: press Win + R and run mstsc.
  • LinuxRemmina, available in the Ubuntu repositories: sudo apt install remmina remmina-plugin-rdp. Choose RDP as the protocol.
  • macOS — Microsoft's Windows App, formerly Remote Desktop, from the App Store.

On the first connection the client warns about an untrusted certificate. This is expected with a self-signed xrdp certificate: check that the address is your server, then accept.

Common problems

  • A black screen after logging in. Almost always the ~/.xsession file is missing or names a session that is not installed. Check step 2.
  • The screen is black and you are using GNOME. GNOME on Wayland does not work with xrdp. Either install Xfce for the remote session, or configure GNOME to use Xorg.
  • Login accepted, then the session closes immediately. Usually a session already running for the same user on the local console. Log out of it, or use a separate account for RDP.
  • The connection times out. Check the firewall rule and that xrdp is running: systemctl status xrdp.
  • Locked out completely after a firewall change — use the console: Managing your CloudVM virtual server in the client area for virtual servers, or What is IPMI (IP-KVM) and how do I connect to it? for dedicated ones.

If you cannot get it working, open a ticket from your client area describing which step fails and what you see — a timeout, a rejected login and a black screen each point to a different cause.


Was this answer helpful?

« Back