Microsoft Rdp For Ubuntu



-->

  1. Windows Rdp Client For Ubuntu
  2. Enable Rdp Ubuntu

Linux virtual machines (VMs) in Azure are usually managed from the command line using a secure shell (SSH) connection. When new to Linux, or for quick troubleshooting scenarios, the use of remote desktop may be easier. This article details how to install and configure a desktop environment (xfce) and remote desktop (xrdp) for your Linux VM running Ubuntu.

The article was writen and tested using an Ubuntu 18.04 VM.

Prerequisites

This will be needed to rdp from the windows machine. The ip address of the machine is highlighted in red: Ubuntu 20.04/20.10: How to enable RDP access from Windows PC. This is all you have to do on the Ubuntu PC. Now go onto the windows PC and connect to the Ubuntu PC as follows: Connecting to the Ubuntu PC from Windows using RDP. There are various desktop environments available in Ubuntu repositories that you can choose. One option is to install Gnome, which is the default desktop environment in Ubuntu 20.04. Another option is to install Xfce. It is a fast, stable, and lightweight desktop environment, which makes it ideal for usage on a remote server. XRDP is an open source software that conforms to the 'Remote Desktop Protocol' of Microsoft, so after installing this software on Ubuntu Server, you can remotely access Ubuntu Server from Windows or MacOS.

This article requires an existing Ubuntu 18.04 LTS VM in Azure. If you need to create a VM, use one of the following methods:

  • The Azure CLI
  • The Azure portal

Install a desktop environment on your Linux VM

Most Linux VMs in Azure do not have a desktop environment installed by default. Linux VMs are commonly managed using SSH connections rather than a desktop environment. There are various desktop environments in Linux that you can choose. Depending on your choice of desktop environment, it may consume one to 2 GB of disk space, and take 5 to 10 minutes to install and configure all the required packages.

The following example installs the lightweight xfce4 desktop environment on an Ubuntu 18.04 LTS VM. Commands for other distributions vary slightly (use yum to install on Red Hat Enterprise Linux and configure appropriate selinux rules, or use zypper to install on SUSE, for example).

First, SSH to your VM. The following example connects to the VM named myvm.westus.cloudapp.azure.com with the username of azureuser. Use your own values:

If you are using Windows and need more information on using SSH, see How to use SSH keys with Windows.

Next, install xfce using apt as follows:

Install and configure a remote desktop server

Now that you have a desktop environment installed, configure a remote desktop service to listen for incoming connections. xrdp is an open source Remote Desktop Protocol (RDP) server that is available on most Linux distributions, and works well with xfce. Install xrdp on your Ubuntu VM as follows:

Tell xrdp what desktop environment to use when you start your session. Configure xrdp to use xfce as your desktop environment as follows:

Restart the xrdp service for the changes to take effect as follows:

Set a local user account password

If you created a password for your user account when you created your VM, skip this step. If you only use SSH key authentication and do not have a local account password set, specify a password before you use xrdp to log in to your VM. xrdp cannot accept SSH keys for authentication. The following example specifies a password for the user account azureuser:

Rdp

Note

Specifying a password does not update your SSHD configuration to permit password logins if it currently does not. From a security perspective, you may wish to connect to your VM with an SSH tunnel using key-based authentication and then connect to xrdp. If so, skip the following step on creating a network security group rule to allow remote desktop traffic.

Create a Network Security Group rule for Remote Desktop traffic

Windows rdp for ubuntu

To allow Remote Desktop traffic to reach your Linux VM, a network security group rule needs to be created that allows TCP on port 3389 to reach your VM. For more information about network security group rules, see What is a network security group? You can also use the Azure portal to create a network security group rule.

The following example creates a network security group rule with az vm open-port on port 3389. From the Azure CLI, not the SSH session to your VM, open the following network security group rule:

Connect your Linux VM with a Remote Desktop client

Open your local remote desktop client and connect to the IP address or DNS name of your Linux VM.

Enter the username and password for the user account on your VM as follows:

After authenticating, the xfce desktop environment will load and look similar to the following example:

If your local RDP client uses network level authentication (NLA), you may need to disable that connection setting. XRDP does not currently support NLA. You can also look at alternative RDP solutions that do support NLA, such as FreeRDP.

Troubleshoot

If you cannot connect to your Linux VM using a Remote Desktop client, use netstat on your Linux VM to verify that your VM is listening for RDP connections as follows:

The following example shows the VM listening on TCP port 3389 as expected:

If the xrdp-sesman service is not listening, on an Ubuntu VM restart the service as follows:

Review logs in /var/log on your Ubuntu VM for indications as to why the service may not be responding. You can also monitor the syslog during a remote desktop connection attempt to view any errors:

Other Linux distributions such as Red Hat Enterprise Linux and SUSE may have different ways to restart services and alternate log file locations to review.

If you do not receive any response in your remote desktop client and do not see any events in the system log, this behavior indicates that remote desktop traffic cannot reach the VM. Review your network security group rules to ensure that you have a rule to permit TCP on port 3389. For more information, see Troubleshoot application connectivity issues.

Next steps

For more information about creating and using SSH keys with Linux VMs, see Create SSH keys for Linux VMs in Azure.

For information on using SSH from Windows, see How to use SSH keys with Windows.

This brief tutorial shows students and new users how to connect to Ubuntu 20.04 | 18.04 via Remote Desktop Protocol (RDP).

In some cases, you may want to connect to Ubuntu desktop via remote desktop using existing protocols. At this moment, it’s pretty easy. Simply install few packages and you’re ready to go.

Windows Rdp Client For Ubuntu

Microsoft

Xrdp is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to graphically control a remote computers.

It provides a fully functional Linux terminal server, capable of accepting connections from rdesktop, freerdp, and Microsoft’s own terminal server / remote desktop clients.

When you’re ready, follow the steps below to get it working.

Step 1: Install Xrdp

Since you already have a desktop environment with Ubuntu Desktop edition, simply run the commands below to Xrdp.

To validate that Xrdp is installed, run the commands below:

That should display similar text as below:

Step 2: Connect from Windows 10

Now that Xrdp server is installed, go and open Windows Remote Desktop Connection app and connect to the desktop hostname or IP address.

Please make to logout of your current Ubuntu desktop sessions. You can’t be logged in to Ubuntu while connecting via Xrdp.

Microsoft Rdp For Ubuntu

When you have logged out of Ubuntu desktop sessions, click Connect to initiate RDP connection. You’ll be prompted for your Ubuntu login details.

Next, type in your Ubuntu machine account username and password and connect using Xorg

When your account username and password are confirmed, you should be logon to your Ubuntu machine from Windows.

That’s it!

Connecting to Ubuntu desktop is easy, since it already has a desktop environment.

Connecting to Ubuntu Servers

Since servers generally don’t have graphical interface, you will need to install a minimal graphical interface for this to work in a server environment.

Run the commands below to install some necessary packages.

Next, xrdp user to the sss-cert group by running the commands below:

Enable Rdp Ubuntu

That should get Xrdp installed and ready for connection on Ubuntu servers.

Since most Ubuntu servers don’t have firewall enabled out of the box, no need to worry about firewall blocking connections.

However, if you have Ubuntu firewall enabled, simply run the commands below to allow RDP traffic.

For example, if you’re connecting 192.168.1.0/24 network, then run the commands below:

That’s it!

Conclusion:

This post showed you how to connect via Remote Desktop Protocol (RDP) to Ubuntu 20.04 | 18.04 Desktop and Servers.

If you find any error above, please use the comment form below to report it.

Thanks,

You may also like the post below: