Based on the article XRDP on Manjaro (fixing the blank screen issue), here is a bash script that automates the process of installing and configuring xRDP on Manjaro Linux with the XFCE desktop environment:
Install the required packages:
sudo pacman -Sy base-devel xorg-server-devel yay
yay -S xrdp xorgxrdp-git
Edit ~/.xinitrc to use xfce4-session instead of xfce-session:
sed -i 's/SESSION=\${1:-xfce-session}/SESSION=\${1:-xfce4-session}/' ~/.xinitrc
Allow anybody to start X:
echo "allowed_users = anybody" | sudo tee -a /etc/X11/Xwrapper.config
Configure xrdp:
sudo systemctl enable --now xrdp.service
#!/bin/bash
# Function to install and configure xRDP
configure_xrdp() {
# Update system
echo "Updating system..."
sudo pacman -Syu
# Install xrdp and xorgxrdp-git from AUR
echo "Installing xrdp and xorgxrdp-git..."
sudo pacman -Sy yay base-devel xorg-xserver-devel
yay -S xrdp xorgxrdp
# Allow any user to start an X session
echo "Configuring Xwrapper..."
echo "allowed_users=anybody" | sudo tee -a /etc/X11/Xwrapper.config
# Configure .xinitrc file for XFCE desktop
echo "Configuring .xinitrc..."
sed -i 's/^\(SESSION=${1:-xfce-session}\)$/#\1 # original\nSESSION=${1:-xfce4-session}/' ~/.xinitrc
sed -i 's/^\s*\(local dbus_args=(--sh-syntax --exit-with-session)\)$/#\1 # original\nlocal dbus_args=(--sh-syntax)/' ~/.xinitrc
sed -i 's/^\(exec $(get_session "$1")\)$/#\1 # original\nexec $(get_session "$SESSION")/' ~/.xinitrc
# Enable xrdp
echo "Enabling xrdp service..."
sudo systemctl enable --now xrdp.service
}
# Call the function
configure_xrdp
To use this script, save it to a file, for example configure_xrdp.sh, then make it executable with the command chmod +x configure_xrdp.sh. Finally, run the script with ./configure_xrdp.sh.
It took me quite a bit of effort to get it to work, hopefully if I have to do it again sometime I can just copy/paste it.