SETTING UP RDP IN AN UBUNTU AWS EC2 INSTANCE
I have faced many situations when I need to run a cloud-based Linux instance
Here, in this article, I have listed the steps I generally take to set up an xRDP server on Ubuntu 22.04 jammy hosted as an AWS EC2 instance.
Step 1: Connect the EC2 Instance [Ubuntu]:
We need to log in to the ec2 instance by using an ssh connection for this time, next time we have the UI so don’t worry. Connect through putty, CLI, or the fastest way in the browser at your comfort.
Step 2: Creating a password for EC2 Instance:
This is an important step so please make sure of it. By default, AWS created a user named ubuntu, but it doesn’t have any passwords. For terminal kind of usage, passwords are not necessary. For UI-based kind of usage, we need a password to log in to the instance, so we need to create a password in this step.
# Change to the superuser
sudo su
# Provide a password for the "ubuntu" user
passwd ubuntu
If you are not interested in Ubuntu users please refer to this link to create a new user For this article.
Step 3: Now the Veritable Installation
After the password creation, we are now ready to install the xRDP.
sudo apt-get update
sudo apt-get install xrdp
Installing a desktop environment: XFCE in our case as xRDP has problems working with Unity and GNOME desktop environment, so we need to install additional too.
sudo apt-get install xfce4
sudo apt-get install xfce4-terminal
Make xRDP use the environment we just create
Recommended by LinkedIn
sudo sed -i.bak '/fi/a #xrdp multiple users’ configuration \n xfce-session \n' /etc/xrdp/startwm.sh
Provide the Firewall permissions, allowing RDP (running at port 3389) to go through the local firewall.
sudo ufw allow 3389/tcp# Restart xRDP
sudo /etc/init.d/xrdp restart
Even though we have provided the permissions in the firewall, we need to open the RDP port in the Security Group.
Step 4: Everything is constructed for a beautiful UI.
The whole setup is done for the xRDP to open an EC2 Instance in your local computer:
o If you are using Windows means, just by using Windows Remote Desktop Protocol
o If you are using Mac, please refer to Microsoft Remote Desktop.
o Remmina can be used with any other platform.
Provide the Username and password that we created in step2.
Your sed command is not quite right.. it should use xfce4-session, not xfce-session which does not exist (at least on Ubuntu22). Also I found this was required as well: https://unix.stackexchange.com/questions/417906/authentication-is-required-to-create-a-color-profile.