Ubuntu – Remote Desktop Sharing in Ubuntu 20.04 “frozen” when monitor is disconnected by KVM

remote desktopvncviewer

I am able to enable remote desktop in Ubuntu (with Vino), and it works fine as long as the monitor is active.
When the KVM controlling the Ubuntu box is switched to a different system, the Remote Desktop session becomes "frozen".

A TightVNC viewer session will connect, and display the Ubuntu desktop. But any attempt to interact with mouse or keyboard is ignored.

How can I enable remote desktop to remain active and usable for a "headless" system, or when the KVM is switched away?

Best Answer

What you probably want is xrdp Remote Desktop Protocol (RDP) server

You can install it like so:

sudo apt install xrdp

After that, use Windows remote desktop app if connecting from windows or remmina if connecting from Ubuntu as clients.

enter image description here

Please see extra information on xrdp homepage page


Notice:

By default xrdp will create a new session when you remotely connect and the local user must be logged out first for this to work or otherwise you will see a blank screen when you connect remotely.

To have xrdp log you in to the existing active logged-in local session instead, follow these steps:

First, enable screen sharing in Ubuntu settings and set a password.

Then, edit /etc/xrdp/xrdp.ini like so:

sudo nano /etc/xrdp/xrdp.ini

Then, copy and paste the following at the end of the file:

[xrdp1-loggedin]
name=Local Active Session
lib=libvnc.so
username=na
password=ask
ip=127.0.0.1
port=5900

Then, save the file and close the editor by pressing Ctrl + x then y then Enter

Finally, run in the terminal:

gsettings set org.gnome.Vino require-encryption false

Next, connect from a remote machine and choose Local Active Session from the Session drop-down menu when you see this screen:

enter image description here

Then, enter the password you set for screen sharing and click the OK button when you see the password field that looks like this:

enter image description here

Related Question