1. Remove previously installed xrdp:
$ sudo systemctl disable xrdp
$ sudo systemctl stop xrdp
$ sudo apt purge xrdp
$ sudo apt purge xserver-xorg-core
$ sudo apt purge xserver-xorg-input-all
$ sudo apt purge xorgxrdp
2. Re-install xrdp & required packages:
$ sudo apt install xrdp
$ sudo apt install xserver-xorg-core
$ sudo apt install xserver-xorg-input-all
$ sudo apt install xorgxrdp
You also need to grant access to the /etc/ssl/private/ssl-cert-snakeoil.key file for xrdp user. It is available to members of the ssl-cert group by default.
$ sudo adduser xrdp ssl-cert # add xrdp into ssl-cert group
$ sudo systemctl start xrdp # start xrdp service
$ systemctl is-active xrdp # display current xrdp service state
...
active
$ sudo systemctl enable xrdp # start xrdp on system startup
3. Reboot system:
$ sudo reboot
4. Firewall configuration (optional):
You need to open access on port 3389.
$ sudo ufw allow 3389
It is more secure to open it only for your IP address or network. For example:
$ sudo ufw allow from 10.5.5.0/24 to any port 3389
The best practice is to use an SSH tunnel to connect to the remote desktop and make xRDP listen only for local connections.
5. Setup your RDP-client
Please note that in some cases the user who will connect to xRDP must log out before doing so!
- Connect to your server using any RDP client.
- Enter the user credentials of your Ubuntu computer.
- Now you can see the remote desktop initial screen.
Related commands:
$ sudo systemctl status xrdp # display current xrdp status
$ sudo systemctl start xrdp # start xrdp service
$ sudo systemctl stop xrdp # stop xrdp service
$ sudo systemctl restart xrdp # restart xrdp service
$ sudo systemctl enable xrdp # enable xrdp on system startup
$ sudo systemctl disable xrdp # disable xrdp on system startup