How to Access Your Linux Desktop Remotely Using XRDP
Remotely working on your Linux machine can be convenient and efficient, especially with the familiar and widely supported RDP (Remote Desktop Protocol).
This guide walks you through setting up and connecting to your Linux desktop remotely using XRDP, a free and powerful third-party RDP server, compatible with multiple Linux distributions.
โ๏ธ Setting Up XRDP on Linux
๐ฆ Install XRDP
Open a terminal and run the appropriate command for your distribution:
Distribution | Command |
---|---|
Ubuntu/Debian | sudo apt install xrdp |
Fedora | sudo dnf install xrdp |
Arch Linux | sudo pacman -S xrdp |
openSUSE | sudo zypper install xrdp |
๐ Configure XRDP
After installing XRDP, open the configuration file:
1
sudo nano /etc/xrdp/xrdp.ini
Ensure the following lines are uncommented and configured:
1
2
port=3389
enable_vsock=true
port=3389
sets the standard RDP port.
enable_vsock=true
enables efficient communication for local virtual machines.
๐ Restart the XRDP Service
1
sudo systemctl restart xrdp
This applies any configuration changes.
๐ Find Your IP Address
To connect to your Linux machine via RDP, youโll need to know its local IP address (on your LAN or network). There are multiple ways to find it, depending on your Linux setup.
๐ฅ๏ธ Option 1: Use ip or ifconfig (Terminal)
Recommended command (modern and widely supported):
1
ip addr show
Hereโs an example output from running ip addr show on a Linux system:
1 2 3 4 5 6 7 8 9 10 11 12 13 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic eth0 valid_lft 86398sec preferred_lft 86398sec inet6 fe80::5054:ff:fe12:3456/64 scope link valid_lft forever preferred_lft forever
Explanation:
lo โ the loopback interface (127.0.0.1
)
eth0 โ an Ethernet interface with IP address192.168.1.100
inet โ IPv4 address
inet6 โ IPv6 address
state UP โ the interface is active
mtu โ Maximum Transmission Unit
link/ether โ MAC address
Look for an entry under your active network interface (eth0, enp0s3, or wlan0) that looks like this:
1
inet 192.168.1.42/24
The IP address is: 192.168.1.42
This method works across most Linux distributions.
Legacy command (still works on many systems):
1
ifconfig
If ifconfig is not found, you may need to install it:
1
sudo apt install net-tools # For Ubuntu/Debian
๐ Option 2: Use hostname -I
This is a quick and clean way to get just the IP address:
1
hostname -I
Output example:
1
192.168.1.42
๐ฑ๏ธ Option 3: Check via GUI (Graphical Interface)
If youโre running a desktop environment:
- Open your Network Settings.
- Click on the active connection (Wi-Fi or Ethernet).
- Look for IPv4 Address or IP Address.
๐ Bonus: Find Your Public IP
If you want to connect from a different network (e.g., over the internet), youโll need your public IP:
1
curl ifconfig.me
๐ง Know Your IP Context
- Local IP (e.g., 192.168.x.x, 10.x.x.x) is for devices on the same network.
- Public IP (e.g., 203.0.113.1) is for access outside your network.
Use with caution โ youโll need proper security, port forwarding, or a VPN.
To check your public IP, use:
1
curl ifconfig.me
๐ Refreshing IP After Reboot
If you restart your Linux machine, its IP address may change (depending on DHCP settings). Consider setting a static IP address or using DHCP reservation on your router if you plan to access the machine frequently.
๐ Firewall Configuration
Make sure your firewall allows RDP traffic on port 3389:
1
sudo ufw allow 3389/tcp
To check firewall status:
1
sudo ufw status
๐ป Connecting to Your Linux Desktop
๐ง Install an RDP Client
Choose an RDP client based on your device:
Platform | Recommended RDP Client |
---|---|
Windows | Microsoft Remote Desktop (built-in) |
Linux | Remmina |
macOS | Microsoft Remote Desktop (Mac App Store) |
Android | Microsoft Remote Desktop / RD Client |
iOS | Microsoft Remote Desktop / RD Client |
๐ช Launch and Configure the RDP Client
In your RDP client, enter:
- Computer: Your Linux machineโs IP address
- Username: Your Linux user name
- Password: Your Linux user password Then click Connect.
You may be prompted to accept a certificate โ this is expected.
๐ง Optional: Install a Lightweight Desktop (If Needed)
Some server distributions donโt include a graphical environment. You can install a lightweight desktop such as XFCE:
1
2
sudo apt install xfce4
echo "startxfce4" > ~/.xsession
Restart XRDP:
1
sudo systemctl restart xrdp
๐ Additional Notes
- ๐ฅ Firewall: Make sure port 3389 is open. For UFW (Ubuntu):
1
sudo ufw allow 3389/tcp
- ๐ง Troubleshooting: If the session fails to start, try installing a desktop environment like XFCE:
1 2
sudo apt install xfce4 echo "startxfce4" > ~/.xsession
- โก Performance: XRDP over RDP usually performs better than VNC, especially on slower networks.
- ๐ Security Tip:
- Use strong passwords.
- Avoid exposing port 3389 directly to the internet.
- Consider setting up an SSH tunnel or VPN for remote access.
- โ Black Screen After Login? Make sure your user has a proper .xsession file and that the desktop environment is installed.
- ๐ Cannot Reconnect After Disconnect? Try restarting the XRDP and session manager services:
1 2
sudo systemctl restart xrdp sudo systemctl restart xrdp-sesman
- ๐ Security Warning or Certificate Error? Accept the certificate if itโs your system. For public access, consider using a custom certificate and SSH tunneling.
๐ก๏ธ Security Best Practices
If youโre enabling RDP access over the internet:
- ๐ Use strong passwords
- ๐ Consider using SSH tunneling or VPN instead of exposing port 3389
- ๐งฑ Restrict RDP to known IP ranges via firewall rules
- ๐ Enable logging and auditing on XRDP and SSH
โ Conclusion
XRDP makes it easy to connect to your Linux desktop from almost any device using the familiar RDP protocol. Whether youโre managing a remote server, helping a colleague, or accessing your home machine on the go, this setup provides flexibility and performance with minimal configuration. With proper firewall, security, and desktop environment setup, you can enjoy a smooth remote experience. Just make sure your system is secure, firewall rules are correct, and you use a reliable RDP client.
๐ References
XRDP Official Site
Remmina โ Remote Desktop for Linux
Ubuntu Firewall Configuration
Enable Remote Desktop on your PC