How to Set Up Remote Desktop on Ubuntu in the Cloud
Setting up a Remote Desktop Protocol (RDP) on an Ubuntu server hosted in the cloud allows you to connect and manage your server using a graphical interface. This guide will walk you through the steps to update your system, install the necessary desktop environment and RDP tools, configure the setup, and connect using an RDP client.
Step 1: Update the System
First, ensure your system is up to date. Open a terminal and run:
sudo apt update
Step 2: Install the Ubuntu Desktop Environment
Installing the ubuntu-desktop
package provides the necessary graphical environment. Note that this step may take around 10 minutes.
sudo apt install ubuntu-desktop
Step 3: Install XRDP
Install the XRDP tool, which allows you to manage remote connections using the RDP protocol.
bashCopy codesudo apt install xrdp
Step 4: Verify RDP Port Listening
Check if the XRDP service is listening on the default RDP port (3389):
netstat -tpln
You should see an output similar to:
tcp6 0 0 :::3389 :::* LISTEN 87763/xrdp
Step 5: Check XRDP Service Status
Verify the XRDP service status to ensure it is running correctly:
sudo systemctl status xrdp
If you encounter permission errors regarding the private key file, proceed to the next step.
Step 6: Fix Permission Issues
If the XRDP service shows errors related to the private key file, follow these steps to fix the permissions:
Map the hostname to
127.0.0.1
in/etc/hosts
:cat /etc/hosts
Change the hostname (if needed) and fix the file permissions:
sudo hostnamectl set-hostname <user-uer-name> sudo chmod 600 /etc/xrdp/key.pem sudo chown xrdp:xrdp /etc/xrdp/key.pem
Step 7: Restart XRDP Service
Restart the XRDP service to apply the changes:
sudo systemctl restart xrdp
Step 8: Verify XRDP Service Status Again
Check the XRDP service status again to ensure there are no errors:
sudo systemctl status xrdp
Step 9: Find Your Public IP
Check your public IP address from the cloud portal or by running:
ifconfig
Step 10: Check Security Group Settings
Before connecting, ensure that the RDP port (3389) is allowed in your instance's security group settings. This step is crucial for permitting RDP connections:
Go to your cloud provider's management console.
Navigate to the security group associated with your instance.
Ensure there is an inbound rule that allows traffic on port 3389 from your IP address or a range of IP addresses.
Step 11: Connect Using RDP Client
Launch your RDP client on your local machine and enter the public IP address of your Ubuntu server. Use the username root
and provide the corresponding password.
using these steps, you should be able to set up and connect to an Ubuntu desktop environment hosted in the cloud using an RDP client. This setup allows for easier management and operation of your server with a graphical interface.
Subscribe to my newsletter
Read articles from vinod chandra directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by