Post

How to Access Your Linux Desktop Remotely Using XRDP

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:

DistributionCommand
Ubuntu/Debiansudo apt install xrdp
Fedorasudo dnf install xrdp
Arch Linuxsudo pacman -S xrdp
openSUSEsudo 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 address 192.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:

  1. Open your Network Settings.
  2. Click on the active connection (Wi-Fi or Ethernet).
  3. 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:

PlatformRecommended RDP Client
WindowsMicrosoft Remote Desktop (built-in)
LinuxRemmina
macOSMicrosoft Remote Desktop (Mac App Store)
AndroidMicrosoft Remote Desktop / RD Client
iOSMicrosoft 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

This post is licensed under CC BY 4.0 by the author.