How to Connect to Amazon Linux 2 Mate GUI using Windows Remote Desktop

Randula Koralage
3 min readApr 28, 2022

--

Photo by Markus Spiske on Unsplash

Amazon Linux 2 with GUI Mate Desktop provides a GUI for the user which is remotely accessible with VNC or RDP. From this article, I will list down simple steps that you can connect to Mate Desktop using Windows default Remote Desktop Client.

It is assumed that you have already set up an ec2 with GUI Mate Desktop before starting the following steps. The instance should be in running state.

The connection process is very easy, first, you have to set up xrdp service properly inside the Linux instance. Also, you need to set a password for the user ec2-user.

What is Xrdp in Linux?

Xrdp is an open-source utility that’s like Microsoft’s Remote Desktop Protocol which allows Remote Clients to access the Linux desktop. Amazon Linux 2 GUI Mate Desktop instance coming with xrdpinstalled, but you can verify it by using sudo systemctl status xrdp

Step 1:ssh into the particular Linux mate desktop ec2 instance.

Use the public IP, particular pem file to login into ec2-user the default user name for Amazon Linux.

Step 2 : Set up a password for ec2-user

sudo passwd ec2-user You’ll ask to enter the password two times under this step.

Step 3 : Check the status of xrdp , sudo systemctl status xrdp

In my case, it gave the following errors

sudo systemctl status xrdp gives errors

Step 4: Generate a certificate

Use the following command to generate a self-signed TLS certificate to encrypt remote desktop sessions. It is not recommended to use a self-signed cert in production. Instead of that use a certificate from an appropriate certificate authority (CA).

sudo openssl req -x509 -sha384 -newkey rsa:3072 -nodes -keyout /etc/xrdp/key.pem -out /etc/xrdp/cert.pem -days 365

Step 5: Restart xrdp services

The above error can be still seen during sudo systemctl status xrdp . In such a case restart xrdp service in following way

sudo systemctl stop xrdp
sudo systemctl start xrdp

Now you have to go to the windows machine that you are using to connect to the Mate desktop.

Step 6: Open Remote Desktop

You can expand the remote desktop dialog box by clicking show option . Give the public IP of the ec2 as Coumputer and ec2-user as User Name . Then click Connect

Remote desktop client

After connecting it will connect you to the Mate desktop and before that it’ll prompt a warning on the certificate. Simply give yes and move forward.

Step 7: Give the Password

Finally, you’ll prompt a small GUI screen to enter the password for ec2-user. Once you gave the password you’ll direct to the expected Mate Desktop in Amazon Linux 2 instance.

You are in!

--

--