Desktop Sharing in Ubuntu

It took me some time to configure desktop sharing in Ubuntu with a bunch of caveats. Therefore, I decided to write this post to elaborate on the procedure.

Env Info

Below are the environment details:

  • Host: Ubuntu 22.04.4 LTS
  • Client: Ubuntu 18.04.6 LTS
  • Remote Desktop Client (in client PC): Remmina 1.4.34
  • Host Desktop Session: X11
    $ echo $XDG_SESSION_TYPE
    x11
    

Enable Desktop Sharing (in host PC)

Under the “Settings” window, look for “Sharing” and enable the toggle switch on the top right corner as shown below:

_config.yml

Next, click on “Remote Desktop”, then enable toggle switches next to “Remote Desktop” and “Remote Control” as shown below:

_config.yml

Remmina Installation (in client PC)


I used snap to install Remmina 1.4.34 using the following command:

$ sudo snap install remmina

Remmina Configuration (in client PC)

Under the “Basic” tab, make sure to select the “Color depth” as “RemoteFX (32 bpp) as shown below:

_config.yml

Firewall Configuration (in host PC)

While trying to connect to host PC using Remmina, host PC reported the following logs:

$ tail -f /var/log/syslog
...
Feb 17 11:59:14 asus kernel: [   77.217435] [UFW BLOCK] IN=eno1 OUT= MAC=a0:36:bc:d0:42:2e:18:1d:ea:f4:11:ae:08:00 SRC=192.168.0.12 DST=192.168.0.14 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=64763 DF PROTO=TCP SPT=49626 DPT=1716 WINDOW=64240 RES=0x00 SYN URGP=0 
Feb 17 11:59:28 asus kernel: [   91.885548] [UFW BLOCK] IN=eno1 OUT= MAC=a0:36:bc:d0:42:2e:18:1d:ea:f4:11:ae:08:00 SRC=192.168.0.12 DST=192.168.0.14 LEN=1035 TOS=0x00 PREC=0x00 TTL=64 ID=36334 DF PROTO=UDP SPT=1716 DPT=1716 LEN=1015 
Feb 17 12:00:09 asus kernel: [  132.695906] [UFW BLOCK] IN=eno1 OUT= MAC=a0:36:bc:d0:42:2e:18:1d:ea:f4:11:ae:08:00 SRC=192.168.0.12 DST=192.168.0.14 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=56927 DF PROTO=TCP SPT=46080 DPT=3389 WINDOW=64240 RES=0x00 SYN URGP=0 
Feb 17 12:00:10 asus kernel: [  133.699629] [UFW BLOCK] IN=eno1 OUT= MAC=a0:36:bc:d0:42:2e:18:1d:ea:f4:11:ae:08:00 SRC=192.168.0.12 DST=192.168.0.14 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=56928 DF PROTO=TCP SPT=46080 DPT=3389 WINDOW=64240 RES=0x00 SYN URGP=0
...

Basically, the firewall is blocking our connection. We can disable the firewall using the following command:

$ sudo ufw disable
Firewall stopped and disabled on system startup

However, it is better not to disable the firewall for security reasons. Instead, we should configure the firewall to allow our connection using the following command:

$ sudo ufw allow from 192.168.0.0/24 to any port 3389 proto tcp

We can see the firewall rules using the following command:

$ sudo ufw status numbered
Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 3389/tcp                   ALLOW IN    192.168.0.0/24  

Just in case, do not forget to enable the firewall using the following command:

$ sudo ufw enable
Firewall is active and enabled on system startup

With the above configurations, we can do Ubuntu 22.04.4 LTS desktop sharing from Ubuntu 18.04.6 LTS.

Allow Locked Remote Desktop

You may notice that the connection closes as soon as the screen locks. In this case, we can use the Allow Locked Remote Desktop GNOME shell extension to prevent connection drop. However, it is important to note that anyone physically close to your computer screen can see what you are doing and potentially collect sensitive information. In order to install “Allow Locked Remote Desktop”, first we need to install the GNOME shell extension manager using the following command:

$ sudo apt install gnome-shell-extension-manager

As of writing this post, I am using “gnome-shell-extension-manager” version 0.3.0. To open the “gnome-shell-extension-manager”, search for “Extension” on installed applications. Now, please search for “Allow locked Remote Desktop”. You may have to select “Recent” from the drop-down menu to find it, as shown below:

_config.yml

Click on the “Install” button to install it. With this newly added configuration, we can seamlessly enable desktop sharing in Ubuntu.

References

  1. How to install Remmina
  2. Unable to RDP into Windows with Remmina
  3. How to add xRDP and XFCE4 o UFW rules?
  4. UFW blocking Remote Desktop even when port is allowed
  5. Allow Locked Remote Desktop
  6. Connect when Remote Desktop is on Login Screen or Screen Locked
Written on February 17, 2024