How to Setup Remote Desktop Control / Sharing in Ubuntu 21.10 / Debian 11

Want to control your Linux PC or server remotely from another machine? Here’s how to set it up via either RDP or VNC protocol in Ubuntu 21.10 / Debian 11 (GNOME or Server).


RPD, stands for Remote Desktop Protocol, is a proprietary protocol developed by Microsoft. It provides encrypted network communications. And, Windows has a built-in RDP client to connect remote servers.

VNC, stands for Virtual Network Computing. It’s a graphical desktop-sharing system that uses the Remote Frame Buffer protocol (RFB) to remotely control another computer. The communication is not encrypted except for the password.

Since GNOME desktop has built-in option to setup screen sharing via VNC, it’s better for remote control from another computer in the same network. Though, it supports open-source encryption plugin to make connection secure for accessing outside the local network.

RPD is more secure than VNC by default. It creates a desktop interface for each connection, and logs in via a (host) system user account and password. It could be “Remote Login” but not “Screen Sharing”.

Option 1: Setup Screen Sharing in Ubuntu via VNC Protocol:

GNOME, the default desktop environments in Ubuntu, Fedora Workstation and other Linux has option in system settings (aka gnome-control-center) to enable screen sharing.

1. Firstly, open ‘Settings’ from upper right system tray menu.

2. When it opens, go to ‘Sharing’ in left pane. Then turn on the toggle icon in the top-right. Finally, click “Screen Sharing” to get the settings dialog:

  • Enable “Allow connections to control the screen” option to allow remote control, or disable it for teaching purpose.
  • Set a password if no one is sitting at the host machine. Or, it asks for confirm on each connection.
  • Choose network if you have both wired and wireless network connected.

After that, you may start connecting to this Ubuntu machine using a VNC client remotely (see last step for details).

Option 2: Setup RDP server in Ubuntu / Debian:

1. Install xrdp server:

Linux has a xrdp package which can work as a RDP server. Debian and Ubuntu user may install it by running command in a terminal window or console:

sudo apt install xrdp

2. Install GNOME or Xfce Desktop:

This step is only for Ubuntu/Debian Server without a Desktop environment. It needs a desktop environment to create a graphical interface for use in remote connections.

Firstly, run command to install the taskel tool via command:

sudo apt install tasksel

Then, run tasksel command. It will provide options to choose a desktop environment to install via following screen:

Choose Desktop to Install
Press spacebar on keyboard to select/un-select an item. And use Tab to switch to OK/Cancel buttons. For Debian, you have to choose the first "Debian desktop environment", and then GNOME or XFCE.

For Ubuntu, use either of the commands below could be more efficient:

  • Install Gnome desktop in Ubuntu via command:
    sudo apt install ubuntu-desktop
  • Install Xfce desktop using command:
    sudo apt install xfce4

3. Setup xrdp server:

Firstly, add user xrdp to the group ssl-cert for use of SSL key. To do so, use command:

sudo gpasswd --add xrdp ssl-cert

Secondly, edit the configuration file “/etc/xrdp/” via command:

sudo nano /etc/xrdp/
You may replace nano with your favorite text editor, e.g., gedit for GNOME desktop.

When file opens, add following two lines above the ‘test -x /etc/X11/Xsession && exec /etc/X11/Xsession‘ line.


For nano text editor, save file by pressing “Ctrl+X”, type “y” and finally hit Enter.

For Xfce desktop, you need also run command to add ‘xfce4-session’ into ~/.xsession file.

echo xfce4-session >> ~/.xsession

4. Configure Firewall:

Ubuntu desktop does not enable the firewall by default, but the server edition does. So you may run command to allow port 3389:

sudo ufw allow 3389 && sudo ufw reload
RDP listens to port 3389 by default. You may change it in "/etc/xrdp/xrdp.ini" config file.

5. start or re-start xrdp service:

After configuration, you need to start or restart (if already started) the service to reload the changes.

  • Enable the service, usually required in Debian:
    sudo systemctl enable xrdp
  • Start the service:
    sudo systemctl start xrdp
  • And restart the service to reload changes, in case it’s already running when editing config file:
    sudo systemctl restart xrdp
  • Check the service status via command:
    systemctl status xrdp

6. Port Forwarding:

To access the computer outside of the local network, you need to enable port forwarding on the router unless the computer has a public IP address.

The steps vary on different routers, though they are generally:

  • Go to Port Forwarding settings in router settings page (e.g.,
  • Create a new rule named ‘remote desktop’
  • Set both internal and external IP to 3389.
  • Input the IP address of your Ubuntu/Debian PC.
  • And finally save it.

Remote control Ubuntu from Windows via VNC or RDP:

After setting up either option in the previous steps, Windows user may download & use the free open-source “Tiger VNC viewer” from the link below:

Click start the EXE, and input the remote Ubuntu IP address to connect. It will prompt to input password if set.

For RDP, just search for and open ‘Remote Desktop Connection’ from Windows start menu, and use the built-in client to make connection:

It will open a window asks to type user and password to login. Just use the username and password in Ubuntu system that you use to login locally.

For Ubuntu, there’s ‘Remmina’ available out-of-the-box as client for RDP/VNC. And Fedora with GNOME 41 now uses “Gnome Connections” as the default remote client.

That’s all. Enjoy!

Exit mobile version