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

@rajhlinux
Copy link

rajhlinux commented Jul 8, 2022

Thanks dude! This worked for me on my Arch Linux Plasma KDE.

I rather prefer XORGRDP as the backend for XRDP since the picture quality is vector based and hence it looks like the remote desktop is running on the local host machine.

@eric-riggan
Copy link

Aaaaaand bookmarked. Works great on KDE

@hzxie
Copy link

hzxie commented Dec 6, 2022

Native RDP has been supported by GNOME >= 42 (Ubuntu >= 22.04).
For detailed information, please refer to https://infinitescript.com/2022/12/enable-microsoft-remote-desktop-rdp-on-linux/

@Venomtek
Copy link

Venomtek commented Mar 4, 2023

Native RDP has been supported by GNOME >= 42 (Ubuntu >= 22.04). For detailed information, please refer to https://infinitescript.com/2022/12/enable-microsoft-remote-desktop-rdp-on-linux/

Too bad it requires the user to be logged in already which is basically useless for 99% of the people who use RDP.

@hzxie
Copy link

hzxie commented Mar 4, 2023

@Venomtek
There are some solutions to fix this problem.
For example, https://extensions.gnome.org/extension/4338/allow-locked-remote-desktop/

@Venomtek
Copy link

Venomtek commented Mar 4, 2023

@Venomtek There are some solutions to fix this problem. For example, https://extensions.gnome.org/extension/4338/allow-locked-remote-desktop/

Yeah because gnome is known for not breaking extensions after an update...
I'd rather implement it properly with xrdp and know that it will continue to work tomorrow instead of using some janky extension.
Maybe one day gnome devs will properly implement it in their backend. I won't hold my breath.

Also your "solution" doesn't work with other desktops, yet xrdp I can switch DEs at will.

@Discreater
Copy link

Discreater commented Dec 22, 2023

Update:
Solved by install xorg-xinit package.

Hi, I can't find the /etc/X11/xinit/xinitrc in my Archlinux:

❯ tree /etc/X11/xinit/
/etc/X11/xinit/
└── xinitrc.d
    ├── 40-libcanberra-gtk-module.sh
    ├── 50-systemd-user.sh
    └── 80-appmenu-gtk-module

2 directories, 3 files

How to solve it?

@sonus89
Copy link

sonus89 commented Mar 12, 2024

Unfortunately it does not work for me:
image

@Venomtek
Copy link

Unfortunately it does not work for me: image

It looks like there is no X server.
Are you using Wayland? If so they have their own RDP implementation now, Weston and Waypipe. And I believe one other they are working at implementing natively.

@Hr46ph
Copy link

Hr46ph commented May 10, 2024

I followed the instructions for Arch, I've been wanting to try this for a long time. I think it all runs but when I start an RDP session, I first get the certificate warning, I accept then nothing.

In the server xrdp.log, I see the following:

[2024-05-10T15:11:43.163+0200] [INFO ] lib_mod_connect: connecting via UNIX socket
[2024-05-10T15:11:43.165+0200] [INFO ] lib_mod_log_peer: xrdp_pid=2366 connected to Xorg_pid=2374 Xorg_uid=1000 Xorg_gid=1000 client=[::ffff:10.0.0.102]:50081
[2024-05-10T15:11:43.166+0200] [INFO ] xrdp_wm_log_msg: Connecting to chansrv
[2024-05-10T15:11:43.168+0200] [INFO ] Received memory_allocation_complete command. width: 1920, height: 1408
[2024-05-10T15:11:43.424+0200] [ERROR] Xorg server closed connection

I tailed the xorg.0.log but the RDP session doesn't log anything there.

Any ideas please?

@Venomtek
Copy link

Xorg is dead.
Gnome and KDE both have implementations for Wayland.

Gnome works rather well now without having to login locally, and with sound too!
https://wiki.gnome.org/Initiatives/Wayland/Remoting#Remote_Login

KDE still sucks.
https://github.com/KDE/krdp

@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.

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