Skip to content

Instantly share code, notes, and snippets.

@valorad
Created June 5, 2022 13:18
Show Gist options
  • Save valorad/7fd3e4a7fb4481f1eb77ded42a72537d to your computer and use it in GitHub Desktop.
Save valorad/7fd3e4a7fb4481f1eb77ded42a72537d to your computer and use it in GitHub Desktop.
Installing xrdp

Ubuntu:

sudo apt install xrdp 
sudo adduser xrdp ssl-cert 
sudo systemctl restart xrdp

Fedora:

Install pacakge

sudo dnf install xrdp xorgxrdp

Configure firewall

sudo firewall-cmd --permanent --add-port=3389/tcp
sudo firewall-cmd --reload

Configure SELinux

sudo chcon --type=bin_t /usr/sbin/xrdp
sudo chcon --type=bin_t /usr/sbin/xrdp-sesman

/etc/X11/Xwrapper.config


# ...

# Allow anybody to start X:
allowed_users=anybody

/etc/xrdp/xrdp.ini

Uncomment the lines for [Xorg]

;
; Session types
;

; Some session types such as Xorg, X11rdp and Xvnc start a display server.
; Startup command-line parameters for the display server are configured
; in sesman.ini. See and configure also sesman.ini.
[Xorg]
name=Xorg
lib=libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1
code=20

xsession

cp /etc/X11/xinit/xinitrc ~/.xsession

replace the last if -fi section with desktop startup command

Example full working config:

# File: ~/.xsession

#!/usr/bin/sh
# Copyright (C) xxxx

# Mandatorily source xinitrc-common, which is common code shared between the
# Xsession and xinitrc scripts which has been factored out to avoid duplication
. /etc/X11/xinit/xinitrc-common

exec dbus-run-session -- startlxqt

Restart services

sudo systemctl restart xrdp
sudo systemctl restart xrdp-sesman

Archlinux

Install pacakge

yay -S xrdp xorgxrdp-git

/etc/X11/Xwrapper.config


# ...

# Allow anybody to start X:
allowed_users=anybody

/etc/xrdp/sesman.ini

# ...
[Xorg]
param=/usr/lib/Xorg
# Leave the rest of the lines untouched
#...

xinit

cp /etc/X11/xinit/xinitrc ~/.xinitrc

~/.xinitrc


# ...

# !!! Remove several lines from "twm" to "xterm",
# !!! since we don't need them and they throw error if not removed

# Start Desktop Environment
exec dbus-run-session -- startplasma-x11

Enable + Restart services

systemctl enable xrdp
systemctl enable xrdp-sesman
systemctl restart xrdp
systemctl restart xrdp-sesman

More info: https://wiki.archlinux.org/index.php/Xrdp

@Hr46ph
Copy link

Hr46ph commented May 10, 2024

I hate Gnome passionately. It is so bad I don't have words to describe just how had it really is.
KDE and Plasma suck almost as badly.
Wayland is still incompatible with some software and has been unstable for me in the past.

Having said that:
Xorg is still alive and (perhaps a little less) kicking and I would never want anything else than XFCE. I love XFCE. Xrdp should work fine with Xorg and XFCE.

Any other ideas? 😸

Edit:
Fixed it by removing xorgxrdp-glamor (I use AMD with open source drivers) and replaced it with the regular xorgxrdp-git version.

@chrisf4lc0n
Copy link

Great guide! Saved me a lot of frustration!
For Arch and XFCE or any other derivatives like CachyOS, etc, ~/.xinitrc should look like that:

#!/bin/sh

xrdb=xrdb
xinitdir=/etc/X11/xinit
xclock=xclock
xterm=xterm
twm=twm
xmodmap=xmodmap

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=$xinitdir/.Xresources
sysmodmap=$xinitdir/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    if [ -x /usr/bin/cpp ] ; then
        $xrdb -merge $sysresources
    else
        $xrdb -nocpp -merge $sysresources
    fi
fi

if [ -f $sysmodmap ]; then
    $xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    if [ -x /usr/bin/cpp ] ; then
        $xrdb -merge "$userresources"
    else
        $xrdb -nocpp -merge "$userresources"
    fi
fi

if [ -f "$usermodmap" ]; then
    $xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d $xinitdir/xinitrc.d ] ; then
 for f in "$xinitdir/xinitrc.d"/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

$twm &
$xclock -geometry 50x50-1+1 &
$xterm -geometry 80x50+494+51 &
$xterm -geometry 80x20+494-0 &
#exec $xterm -geometry 80x66+0+0 -name login
exec dbus-run-session -- startxfce4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment