Simplified XRDP Installation on Ubuntu 22.04 Server

Remote Desktop Protocol developed by Microsoft that allows users to remotely access and interact with the graphical user interface of a remote Windows server. RDP works on the client-server model.

RDP is commonly used for Windows remote connections, but a tool like this can also allow you to access and interact with a remote Linux server’s graphical user interface Xrdp, an open-source implementation of the RDP server.

In this tutorial, you will install and configure an RDP server using Xrdp on a Ubuntu 22.04 server and access it using an RDP client from your local machine. You will understand how to establish access to a remote Linux server by configuring and using an RDP connection.

From the available options for Ubuntu, Now we will install the Xfce desktop environment. Xfce is an lightweight, user-friendly desktop environment for Linux-based operating systems.

To begin, connect to your server using SSH and update the list of available packages using the following command:

apt update

Then, install the xfce and xfce-goodies packages on your server:

apt install xfce4 xfce4-goodies -y

Step 2 — Installing xrdp on Ubuntu

apt install xrdp -y

systemctl status xrdp (This command will display the status as “running,” or active.)

If the status of xrdp is not running, you may have to start the service manually with this command:

systemctl start xrdp

Make sure xrdp is operating by checking the status again after executing the above command.

On your server, xrdp is now installed. Reviewing the xrdp settings to allow connections from distant clients is next.

Step 3 — Configuring xrdp and Updating Your Firewall

nano /etc/xrdp/xrdp.ini

Go to the Session types section of the config. file. The following list of parameters corresponds to the many possible session types:

The username and password parameters are by default set to ask, meaning that in order to connect using RDP, the user will be asked to provide their login and password. If needed, parameters like name, username, and password can be changed. The default configuration will work for the first RDP connection to the server.

Save and close the file when finished.

Now move to your user’s home directory if you are not there already: cd ~

Next Step 4, add the xfce4-session as the session manager to be used upon login by creating a.xsession file under /home/root:

echo “xfce4-session” | tee .xsession

Restart the xrdp server: systemctl restart xrdp

The next step is to set up your firewall to accept connections on port 3389 from your public IP address. TCP/IP port 3389 is used for an RDP connection. Your firewall must enable port 3389 in order for you to use RDP to access the remote server.
First, locate your local machine’s public IP address:

curl ifconfig.me (your public IP will be displayed)

Next, allow access to the RDP port 3389 on your remote server, replacing your_local_ip with the output of the last command:

sudo ufw allow from your_local_ip/32 to any port 3389

Verify the status of your UFW firewall: sudo ufw status

Output

Status: Active

To                         Action      From

OpenSSH                    ALLOW       Anywhere                 

3389                       ALLOW       your_local_ip

Step 5: Checking the RDP Connection in Step Four

You will test the RDP connection from your local machine in this stage. Steps to test the connection on Linux, macOS, and Windows computers are included in the sections below.
Examining the Windows RDP Connection
Open the Remote Desktop Connection application first, then use the Remote Desktop Connection client on Windows to test the connection.
Fill in the fields labeled “Computer” and “User name” with the public IP address and username of your remote server. It might be necessary to use the Show Options down arrow key to enter the username:

Click the “Connect” button. Make sure you have enabled distant Desktop in your system settings if you get an alert saying that it is unable to establish a connection with the distant machine.

If the identification verification dialog appears, click Yes.

Next, type the password you made for the user when you first set up the server, along with the username (root) of the remote server. Click “Ok.”

Once you have logged in, you should be able to access your Ubuntu Desktop environment:

You have successfully established a remote connection from your local computer to your Ubuntu server using RDP. After using your graphical desktop for the duration of the session, you can end it by pressing the exit button.

Verifying the RDP Connection
Open the Microsoft Remote Desktop Connection application first, then use the Remote Desktop Connection client on Windows to test the connection.
Apply pressure. Add PC, then fill in the form with the public IP address of your remote server:
You are able to While establishing the connection, add a user account:
You will be asked for your user login information if you don’t add a user during setup:
To dismiss the identity verification pop-up, click Yes:
You can access your Ubuntu remote desktop after logging in. After using your graphical desktop for the duration of the session, you can end it by pressing the exit button.

if you face Default Browser Issue we will install Firefox using Terminal Emulator

install Firefox:

snap install firefox -Y

Then we have to change Default browser from ubuntu built in browser to firefox

In terminal run xfce4-settings-manager >>Below System Options >> Select Default Applications

In Internet menu below Web Browser select Mozilla Firefox.

Scroll to Top