How to setup RDP Support for Linux VM
Setup RDP Support for Linux VM
- Within the Azure Portal, locate the Virtual machine blade for your Linux VM. Then clicking Create button will give you a sample SSH command to use at the Bash Shell. Or, you can also retrieve the Public IP address from the Overview pane to type the command manually, or using a utility like PuTTy to connect.
The SSH command will have the following syntax:
ssh <username>@<ip address>
- When using the SSH command, you’ll need to enter it into a bash shell on your local machine. This could be the “Ubuntu Bash Shell” on Windows 10, or a Terminal window on macOS.
- When prompted, enter the Username and Password what was specified for the Admin user when the Ubuntu Linux VM was created previously.
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 lxde on the Linux VM:
sudo apt-get install lxde -y
If you’re interested in using the Ubuntu Desktop UI instead, you can use the great tips from Sorcia25 here: https://sorcia25.wordpress.com/2018/03/02/how-to-setup-an-ubuntu-linux-vm-in-azure-with-remote-desktop-rdp-access-ubuntu-desktop-gui/
- 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
- Next, you need to start xrdp running on the VM. This can be done with the following command:
- Next, before you can Remote Desktop into the Linux VM, you need to be sure to open port 3389on the Network Security Group (NSG) that is securing access to the VM within Azure. To do this, navigate to the Resource group blade for your VM, then click on the Network Security Groupresource.
- On the Network security group blade, click on the Inbound security rules link.
- Click the +Add button then fill in the following details for a new Inbound security rule to open port 3389, then click OK.
- Source: Any
- Source port ranges: *
- Destination: Any
- Destination port ranges: 3389
- Protocol: TCP
- Action: Allow
With RDP support installed on the Ubuntu Server Linux VM in Azure, and the NSG Firewall is open on Port 3389 to allow RDP connections, you are ready to use a Remote Desktop client to connect.