Remote Desktop Service (RDP) is a system to access your Linux machine from another computer, providing a graphical desktop interface. This is particularly useful for remote administration or troubleshooting. In this tutorial, I’ll explore how to enable Remote Desktop on Linux using different methods, including XRDP, VNC, SSH with X forwarding and xfce-desktop-environment.
Method 1: Using XRDP (RDP Protocol)
XRDP is an open-source implementation of Microsoft’s RDP, allowing you to access Linux systems from a Windows or Linux machine.
Step 1: Install XRDP
Open a terminal and run:
For Debian/Ubuntu-based systems:
sudo apt update sudo apt install xrdp -y
For Fedora/RHEL-based systems:
sudo dnf install xrdp -y
Step 2: Enable and Start XRDP Service
sudo systemctl enable xrdp sudo systemctl start xrdp
Step 3: Configure Firewall
Allow RDP traffic through the firewall (default port 3389):
sudo ufw allow 3389/tcp sudo ufw reload
Step 4: Connect Using RDP Client
- On a Windows machine, open the Remote Desktop Connection tool.
- Enter the IP address of your Linux machine and click Connect.
- Provide your username and password to log in.
Method 2: Using VNC for Remote Desktop Access
VNC (Virtual Network Computing) allows remote access by sharing the desktop over the network.
Step 1: Install VNC Server
For Debian/Ubuntu-based systems:
sudo apt update sudo apt install tigervnc-standalone-server -y
For Fedora/RHEL-based systems:
sudo dnf install tigervnc-server -y
Step 2: Set a Password for VNC
Run the following command and set a password:
vncpasswd
Step 3: Start the VNC Server
Start the VNC server manually:
vncserver :1
This creates a session on port 5901 (:1
corresponds to 5901).
Step 4: Configure Firewall
Allow VNC traffic:
sudo ufw allow 5901/tcp sudo ufw reload
Step 5: Connect Using VNC Client
- Install a VNC client (e.g., RealVNC Viewer) on your local machine.
- Enter your Linux machine’s IP address followed by the port (e.g.,
192.168.1.10:1
). - Provide your VNC password to access the desktop.
Method 3: SSH with X11 Forwarding
For lightweight remote access, you can use SSH with X11 forwarding to run graphical applications from a remote Linux system.
Step 1: Install SSH Server
For Debian/Ubuntu-based systems:
sudo apt update sudo apt install openssh-server -y
For Fedora/RHEL-based systems:
sudo dnf install openssh-server -y
Step 2: Enable and Start SSH Service
sudo systemctl enable ssh sudo systemctl start ssh
Step 3: Enable X11 Forwarding
Ensure that X11 forwarding is enabled in the SSH configuration:
Open the SSH config file:
sudo vim /etc/ssh/sshd_config
Find the line
X11Forwarding no
Change to
X11Forwarding yes
Restart the service
sudo systemctl restart ssh
Method 4: @xfce-desktop-environment
To Enable Remote Desktop Service in Linux follow the steps bellow.
For Fedora
Step 1 : Install the desktop environment with the following commands.
$–> sudo dnf install @xfce-desktop-environment
$–> suod dnf install tigervnc-server
reboot the system
make sure
That’s It.