Cannot connect to Ubuntu 22.04 through RDP

PROBLEM: can’t connect to my Ubuntu server through RDP.


[Window Title]
Remote Desktop Connection

Remote Desktop can’t connect to the remote computer for one of these reasons:

  1. Remote access to the server is not enabled
  2. The remote computer is turned off
  3. The remote computer is not available on the network

Make sure the remote computer is turned on and connected to the network, and that remote access is enabled.

[Expanded Information]
Error code: 0x204
Extended error code: 0x0


  1. sudo apt-get update
  2. sudo apt install xfce4 xfce4-goodies xrdp net-tools xorg dbus-x11 x11-xserver-utils
    #I followed different installation guides in case the problem was caused by lacking some packages + I installed net-tools to check stuff with netstat
  3. sudo systemctl status
    #checked that xrdp was running
  4. sudo adduser xrdp ssl-cert
  5. sudo systemctl restart xrdp
  6. sudo ufw allow from any to any port 3389
  7. sudo ufw allow 3389


  1. made sure that xrdp was listening to 3389 using netstat
  2. made sure that 3389 port was opened
  3. made sure that the VM port was opened in the VM hosting service I use
  4. made sure that the xrdp.ini file didn’t have incorrect setting inside
  5. made sure use_vsocket was set to =false
  6. made sure that automatic login was turned off
  7. tried logging out and connecting through mstsc, got the same result
  8. tried rebooting 🙂
  9. went through xrdp logs with journalctl xrdp – seems like there was no connection


  1. for connection I’m trying to use the default user "ubuntu" with sudo privileges which was created during VM set up
  2. I’m new
Asked By: gunter


Don’t know if this will solve everyone’s problem but after doing all of the above without success, I found that using the password generated in the Ubuntu Sharing settings in MRD did the trick.


Answered By: bikermike

It’s not recommended to run at the same time xRDP software and enable Ubuntu Sharing application because they are using the same port (i.e. 3389) which can create conflicts. It’s either xRDP or Sharing Application..

Both applications have pro and cons….

  • Sharing Application allows you to perform RDP to your Ubuntu machine but a user needs to be logged on. If the session is locked, the session will ends
  • xRDP allows you to perform RDP to your Ubuntu machine but a same user can only be logged on either locally or remotely…not both at the same time. xRDP create a new session and you cannot take over an existing session.

If you want to use/test xRDP software solution, you should try the following

If xRDP software has been already installed on your Ubuntu

Step 1 – Disable the Sharing Application Feature
Step 2 – Restart xrdp process issuing in a Terminal console

systemctl restart xrdp

Step 3 – Check that xrdp process is running accordingly issuing in a Terminal console

sudo systemctl status xrdp 

Step 4 – Restart the machine
Step 5 – Do not login locally on your Ubuntu machine
Step 6 – Fire up your favourite rdp client
Step 7 – If you see the xRDP login screen, provide your Ubuntu credentials
Step 8 – You should see a Desktop interface loading…but might not be the one you are expecting

You can find some additional information and resources in my blog. You can find in our blog a small script that can ease the installation of xRDP software (see xRDP – Easy install xRDP on Ubuntu 20.04,22.04,23.XX (Script Version 1.4.8)

Hope this help

Answered By: Griffon