Install Xrdp Server on Ubuntu 22.04

This guide is going to take you through on how to Install Xrdp Server on Ubuntu 22.04. Xrdp is a free and open-source implementation of Microsoft’s RDP (Remote Desktop Protocol) server that allows non-Windows operating systems (such as Linux and BSD-style operating systems) to deliver a fully functional RDP-compatible remote desktop experience. It works by relaying controls from the client back to the X Window Server and bridging graphics from the X Window System to the client.

How to Install Xrdp Server on Ubuntu 22.04

  • Update your packages using the command below.
sudo apt update
  • Next Install Xrdp Server on Ubuntu 22.04 using the following command.
sudo apt install xrdp

Sample output

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fonts-open-sans gir1.2-gnomebluetooth-1.0 i965-va-driver
  intel-media-va-driver kwayland-data libaacs0 libavcodec58
  libavformat58 libavutil56 libbdplus0 libbluray2
  libchromaprint1 libcodec2-1.0 libdouble-conversion3
  libgme0 libgsm1 libigdgmm12 libkf5waylandclient5 libmd4c0
  libmfx1 libminizip1 libmng2 libnorm1 libopenal-data
  libopenal1 libopenmpt0 libpcre2-16-0 libpgm-5.3-0
  libqrcodegencpp1 libqt5core5a libqt5dbus5 libqt5gui5
  libqt5network5 libqt5svg5 libqt5waylandclient5
  libqt5widgets5 librabbitmq4 librlottie0-1 libshine3
  libsndio7.0 libsrt1.4-gnutls libssh-gcrypt-4
  libswresample3 libswscale5 libudfread0 libva-drm2
  libva-x11-2 libva2 libvdpau1 libx264-163 libxcb-record0
  libxcb-screensaver0 libxcb-xinerama0 libxcb-xinput0
  libxvidcore4 libzmq5 libzvbi-common libzvbi0
  mesa-va-drivers mesa-vdpau-drivers qt5-gtk-platformtheme
  qt5-image-formats-plugins qttranslations5-l10n
  va-driver-all vdpau-driver-all
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
Suggested packages:
The following NEW packages will be installed:
  xorgxrdp xrdp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 582 kB of archives.
After this operation, 3,380 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 jammy/universe amd64 xrdp amd64 0.9.17-2ubuntu2 [517 kB]
Get:2 jammy/universe amd64 xorgxrdp amd64 1:0.2.17-1build1 [65.3 kB]
Fetched 582 kB in 1s (1,115 kB/s)
  • Xrdp Server should be up and running after installation, check status using the command below.
sudo systemctl status xrdp

Sample output

● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-04-18 13:20:37 EAT; 2min 1s ago
       Docs: man:xrdp(8)
    Process: 10974 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
    Process: 10982 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 10983 (xrdp)
      Tasks: 1 (limit: 4588)
     Memory: 860.0K
        CPU: 21ms
     CGroup: /system.slice/xrdp.service
             └─10983 /usr/sbin/xrdp

Apr 18 13:20:36 systemd[1]: Starting xrdp daemon...
Apr 18 13:20:36 xrdp[10982]: [INFO ] address [] port [3389] mode 1
Apr 18 13:20:36 xrdp[10982]: [INFO ] listening to port 3389 on
Apr 18 13:20:36 xrdp[10982]: [INFO ] xrdp_listen_pp done

Configure Xrdp Server on Ubuntu 22.04

  • Xrdp created a user named xrdp in your system during the installation. The xrdp session uses the “/etc/ssl/private/ssl-cert-snakeoil.key” certificate key file.
  • To make the file readable by the user, we need add the xrdp user to the ssl-cert group using the following command.
 sudo adduser xrdp ssl-cert

Allow Xrdp Server on Firewall

  • By default Xrdp listens on port 3389, if you are using firewall allow Xrdp using the following command.
sudo ufw allow from to any port 3389
  • Next reload firewall to apply new changes.
sudo ufw reload 

Connect to Ubuntu 22.04 Xrdp Server

  • In this example, we will connect to the Xrdp server we just set up using windows 10.
  • Open RDP app and enter your Ubuntu system IP address.
  • You will be prompted to confirm if you want to connect.
  • Next enter your Ubuntu credentials to connect as shown below.
  • NOTE: Ensure that the user you are using for RDP is not already logged in via the desktop user interface.

If you get a black blank screen simply logout first on your Ubuntu then reconnect the windows RDP.

You also need to modify the Xrdp start script, /etc/xrdp/ and add the lines;


Such that the script looks like;

# xrdp X session start script (c) 2015, 2017, 2021 mirabilos
# published under The MirOS Licence

# Rely on /etc/pam.d/xrdp-sesman using pam_env to load both
# /etc/environment and /etc/default/locale to initialise the
# locale and the user environment properly.

if test -r /etc/profile; then
        . /etc/profile


test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

This requires an Xrdp restart

systemctl restart xrdp
  • After successful connection, you will be connected to the Ubuntu running Xrdp server.
  • You have made it to the end of the article, Cheers! . You have learned how to Install Xrdp Server on Ubuntu 22.04.
    Read more about Xrdp

Other Tutorials

Install ELK Stack 8 on Rocky Linux

Install Filebeat 8 on Rocky Linux

Install Thunderbird mail client on Rocky Linux

System administrator | Software Developer | DevOps

Leave a Comment