Go to ...

RSS Feed

January 16, 2021

Remote Desktop Connection to Linux

I am a big Hyper-V fan, but even I must admit that running Linux virtual machines within that hypervisor can be problematic. First, enhanced session mode does not work, so changing guest resolution is quite difficult. In addition, Copy & Paste between the Windows host and the Linux guest does not work.  One option is to create a boot menu entry to start Windows without its built-in Hyper-V Hypervisor, and then to run Linux virtual machines in VMware Workstation or Oracle VirtualBox (see my tutorial on TenForums.com).

Another simpler solution is to use the Windows native Remote Desktop Connection. Install any Linux distro into a Hyper-V virtual machine, then install Xrdp on it:

Xrdp is a free and open-source implementation of Microsoft RDP (Remote Desktop Protocol) server that enables operating systems other than Microsoft Windows (such as Linux and BSD-style operating systems) to provide a fully functional RDP-compatible remote desktop experience.

(Quote from https://en.wikipedia.org/wiki/Xrdp)

That’s it. You can now establish a remote connection to your Linux virtual machine, freely selecting resolution, plus full bidirectional Copy & Paste, and full access to drives on the remote client and the virtualization host.

In this post, I will show how to setup Xrdp in CentOS Linux, my favorite distro, and in Ubuntu, the most popular distro. Here goes:


Please notice, the same instructions work also for Red Hat Enterprise Linux, only one command being slightly different. (Note: the Gnome desktop user interface is required for this to work.)

In Terminal, switch to root. Xrdp will be installed from Epel repository, which needs to be installed first with following command (CentOS only):

yum install -y epel-release

To install Epel repository in Red Hat Enterprise Linux, use the following command:

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Next, install both TigerVNC Server and Xrdp with following command (CentOS and RHEL):

yum install -y tigervnc-server xrdp

… and then, make Xrdp start automatically at boot (CentOS and RHEL):

systemctl enable xrdp

Xrdp listens on TCP/UDP port 3389. We need to add a firewall rule to allow connections to that port (CentOS and RHEL):

firewall-cmd --permanent --add-port=3389/tcp

That’s it. Restart CentOS. You can now use the Remote Desktop Connection in Windows to connect to your CentOS machine, physical or virtual.


Please notice that these instructions apply to other Debian based Linux distros, too. The instructions apply to manual installations; using Hyper-V Quick Create feature to create Ubuntu VM has Xrdp integrated and Enhanced Session Mode enabled, so no additional steps are required.

Ubuntu does not need any additional repositories to be installed, nor does it need any firewall rules to be set. Two simple commands are all we need. First, install Xrdp with the following command:

sudo apt install xrdp

… and set Xrdp to start automatically at boot:

sudo systemctl enable xrdp

Restart Ubuntu. You can now use Remote Desktop Connection to connect to it:

Easy and fast! Enjoy.


Author: Kari Finn

A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

3 Responses “Remote Desktop Connection to Linux”

  1. December 10, 2020 at 23:49

    Hi, hope you’ll read this and respond. I have trouble logging in the VM Ubuntu 18.04.3 LTS on host W10. This only occurs when switched to enhaced mode. Tried to chmod `/.Xauthority in all flavours to no avail.

    When feeding the credentials defined at setup of the VM, connection is closed, another is tried to be established and then crashes.

    Any thoughts on this, please?

    • December 11, 2020 at 09:49

      Don’t use Hyper-V enhanced mode. Use Remote Desktop Connection instead.

  2. December 12, 2020 at 11:11

    Thank you, Sir.
    Unfortunately, I found out that my comapnies device is controlled by my employer and RDC is not available for me. Got to find me another way instead…

Leave a Reply

More Stories From Hyper-V