Set up Remote Desktop Access (RDP) on a Linux VM on Azure

Spread the love

Normally, when you setup a Linux VM (for example an Ubuntu Server) in Microsoft Azure, you can only connect to and remote into it via SSH. It differs from a Windows VM in Azure, as Linux VMs do not support Remote Desktop (RDP) natively. In the following steps we are going to see how to set up an RDP Connection to a Linux VM in Azure

Prerequisites

To complete this tutorial you need the following:

Create a Linux VM on Azure

Using the Azure Portal (http://portal.azure.com), click on Create a resource in the left-side navigation, then select the Compute category, then click on Ubuntu Server.

Next fill in some details about your VM for the basics Networking etc. Make sure you open the SSH and RDP inbound ports.

Review all the info and select Create to create the virtual machine.

Set up Remote Desktop Connection

I am going to use Bash on Windows

Open a cmd and type bash

bash

Then type ssh <user>@<IP address> to connect to the Virtual Machine

ssh user@5*.***.***.*2

Also, you’ll likely be prompted with an “Are you sure you want to continue connecting (yes/no)?” message. The reason for this is that your local machine hasn’t seen the key fingerprint from that Linux machine yet. For the sake of the exercise, type yes and press Enter to continue. Once you enter “yes”, you’ll need to enter the SSH command again to initiate the connection.

Next, you’ll need to install a Desktop graphical UI (User Interface) before you’ll be able to setup RDP support. To do this, you can run the following command to install the Unity Desktop GUI on the Linux VM. Run the following commands in your cmd session

sudo apt-get update
sudo apt-get install ubuntu-desktop

Then Restart the VM in the Azure Portal

You can see that the Unity Desktop is installed by using Boot diagnostics in the Azure portal

Next, you’re ready to install RDP support by installing the xrdp project on the VM. You can do this with the following command:

sudo apt-get install xrdp -y

Then, you need to start xrdp running on the VM. This can be done with the following command:

sudo /etc/init.d/xrdp start

Thats it! Now connect to the Linux VM with Remote Desktop Client

Leave a Reply

Your email address will not be published. Required fields are marked *