Ubuntu is a popular Linux operating system. As with most Linux distributions, it can be used with different desktop environments (XFCE, KDE, Gnome etc). The XFCE desktop environment is popular with Ubuntu users as it is a lightweight desktop environment.
Xrdp, on the other hand, is an application that provides remote access to Ubuntu using the remote desktop protocol (RDP).
In this article, we will explain the steps to install and configure xrdp for users using the XFCE desktop environment in the Ubuntu operating system.
If you do not have the XFCE desktop environment in Ubuntu, you can see the steps for installation in the step below. If it is already installed, you can continue with XRDP installation.
Step-1: Install XFCE
First pull the package list and get the updates:
foc@ubuntu20:~$ sudo apt update && sudo apt upgrade
This command will update all packages in the system and upgrade them to the latest version. Enter the following command to install Xfce4:
foc@ubuntu20:~$ sudo apt install xfce4 tasksel -y
Then all the dependencies of XFCE are installed with tasksel:
foc@ubuntu20:~$ sudo tasksel
If there are different desktop environments you want to install on this screen, you can choose:
On the login screen, select the XFCE session and login:
XFCE4 desktop environment installation completed successfully.
Step-2: Install XRDP
Enter the following command to install xrdp:
foc@ubuntu20:~$ sudo apt install xrdp -y
Enter the following command in terminal to enable xrdp service :
foc@ubuntu20:~$ sudo systemctl enable xrdp
Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable xrdp
and start the service:
foc@ubuntu20:~$ sudo systemctl start xrdp
Optional: If you are using a firewall, enter the following command to edit the firewall settings:
foc@ubuntu20:~$ sudo ufw allow 3389/tcp
Rules updated
Rules updated (v6)
And reload the firewall:
foc@ubuntu20:~$ sudo ufw reload
Firewall reloaded
Step-3: XRDP Configuration
Change the /etc/xrdp/startwm.sh file as follows, this will prevent you from getting a black screen:
foc@ubuntu20:~$ sudo vi /etc/xrdp/startwm.sh
The following lines are added above the "test -x /etc/X11/Xsession && exec /etc/X11/Xsession" line:
unset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR
The "xfce4-session" command is added to the ".xsession" file to allow the Xfce desktop to start automatically whenever the user logs in:
foc@ubuntu20:~$ echo xfce4-session >> ~/.xsession
Note: Many configurations such as login screen sizes(width,height), rdp port(3389) information are included in the txrdp.ini file.
foc@ubuntu20:~$ sudo nano /etc/xrdp/xrdp.ini
The xrdp service needs to be restarted after the change:
sudo systemctl restart xrdp
Configuration complete, let's connect.
Step-4: XRDP Connection
You can use different RDP applications according to the operating system you are using. Some RDP applications you can use as examples:
- Remmina
- Connections
- Vinagre
- KRDC
- FreeRDP
- rdesktop
- NoMachine
- ThinLinc
- TigerVNC
- Guacamole
For example, let's connect with the Gnome Connections application:
Enter the username and password with the authorization to log on to the remote server:
Connection established. Introducing XFCE4 on Ubuntu.
If you want to RDP on Windows, you can access the remote desktop connection by typing "mstsc" in the run window or command line:
Summary
We explained XRDP installation and configuration to make RDP connection to XFCE4 desktop environment in Ubuntu. Depending on the Ubuntu version, there may be changes in the configurations, but in general the above steps will suffice.
References
help.ubuntu.com - xrdp