I was trying to set up RDP (Remote Desktop Protocol) with Guacamole and ran into a brick wall!
I spent a good while pulling my beard out over this problem. Everything was working fine—MariaDB was set up, guacd was running, Guacamole was installed—but RDP just wouldn’t connect. 😪
I turned to Google! After some digging, I came across a solution that finally worked like a charm. Here’s the code that saved me:
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install xfce4
sudo apt install xfce4-session
sudo adduser xrdp ssl-cert
echo xfce4-session >~/.xsession
sudo service xrdp restart
Let me break it down for you:
- The first line runs
sudo apt-get update
, which refreshes the package list on your system. Always a good idea before installing or updating anything to make sure you’ve got the latest versions available. - Installs the XFCE4 desktop environment. The
DEBIAN_FRONTEND=noninteractive
part ensures the installation process doesn’t ask for any user input, and the-y
flag says “Yes” to everything automatically. Basically, it installs XFCE4 without asking you a bunch of questions. sudo apt install xfce4-session
adds the session manager that’s needed for XFCE4 to run properly in an RDP session.- This line is key.
sudo adduser xrdp ssl-cert
gives the xrdp user the necessary permissions by adding it to thessl-cert
group. Without this, you might run into permission errors when trying to establish an RDP session. - Set the Session to XFCE4:
echo xfce4-session >~/.xsession
tells the system to use XFCE4 as the desktop environment for the session. It’s like saying, “Hey, when I RDP in, load up XFCE4.” - Finally, restarts the xrdp service to apply the changes. After this, you should be good to go!
Why Did It Solve My RDP Problem?
When you try to connect to a Linux machine via RDP, the server needs to have a desktop environment set up to show you. Without one, there’s no “interface” to display, so the connection will fail. In my case, XFCE4 was the missing piece of the puzzle. By installing XFCE4, I gave my server a desktop environment that Guacamole could display when I connected using RDP.
Without a desktop environment like XFCE4, the RDP connection was just hanging because it didn’t have a GUI to show. Once XFCE4 was installed, it worked like magic!
Update:
After a server restart, I ran into an issue where XRDP refused to start. The error message I got was:
scssCopy code[ERROR] g_tcp_bind(7, 3389) failed bind IPv6 (errno=98) and IPv4 (errno=22).
[CORE ] Failed to start xrdp daemon, possibly address already in use.
Turns out, the gnome-remote-desktop service was occupying port 3389, which XRDP needed to use. The fix was simple: I disabled gnome-remote-desktop, makeing the port for XRDP free.
Here’s how I did it:
sudo systemctl stop gnome-remote-desktop
sudo systemctl disable gnome-remote-desktop
sudo systemctl restart xrdp
We first stop the gnome-remote-desktop and later disabled to not start after a new restart and restarted xrdp.
This allowed XRDP to start properly and restored my RDP connection without any further issues.
TL:DR;
I found the code in the link below that solved an issue trying to connect in ubuntu via RDP though Guacamole.