Wednesday, April 15, 2026

Debian: Setting Up an XRDP Remote Desktop Server for KDE-Plasma or Gnome

To configure a remote desktop server in Debian OS, perform the following steps:

Installing "xrdp":
sudo apt update && apt upgrade
sudo apt install xrdp dbus-x11 -y



If the Russian keyboard layout is missing in the remote session, add the following lines to the end of the file "/etc/xrdp/xrdp_keyboard.ini" and restart the service "sudo systemctl restart xrdp":

[rdp_keyboard_ru]
keyboard_type=4
keyboard_type=7
keyboard_subtype=1
model=pc105
options=grp:alt_shift_toggle
rdp_layouts=default_rdp_layouts
layouts_map=layouts_map_ru

[layouts_map_ru]
rdp_layout_us=us,ru
rdp_layout_ru=us,ru



If you see a black screen after logging into the remote session, replace the content of the file "/etc/xrdp/startwm.sh" with:

#!/bin/sh
# Destroy variables that may interfere with the D-Bus session
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
# Launch D-Bus for the user session
export $(dbus-launch)
# Set keyboard layouts for Russian and English, switch with Alt+Shift
setxkbmap -layout "us,ru" -variant ",winkeys" -option "grp:alt_shift_toggle"
# Launch KDE Plasma in X11 mode
exec startplasma-x11

and restart the service "sudo systemctl restart xrdp".


To add a policy allowing power management actions from a remote session:

Create the file "/etc/polkit-1/rules.d/10-allow-reboot.rules" with the following content:

polkit.addRule(function(action, subject) {
var actions = [
"org.freedesktop.login1.reboot",
"org.freedesktop.login1.reboot-multiple-sessions",
"org.freedesktop.login1.power-off",
"org.freedesktop.login1.power-off-multiple-sessions",
"org.freedesktop.login1.suspend",
"org.freedesktop.login1.suspend-multiple-sessions",
"org.freedesktop.login1.hibernate",
"org.freedesktop.login1.hibernate-multiple-sessions"
];
if (actions.indexOf(action.id) !== -1) {
return polkit.Result.YES;
}
});



If you encounter problems, you can check the log:
sudo tail -50 /var/log/xrdp-sesman.log

No comments:

Post a Comment