KDE桌面环境安装xrdp远程桌面

本文适用于使用 kde 桌面环境的 deb 系linux发行版。原文链接在此

install xrdp service

1
2
sudo apt install -y xrdp

fix black cursor bug

1
2
sudo sed -e 's/^new_cursors=true/new_cursors=false/g' -i /etc/xrdp/xrdp.ini

enable and start xrdp service

1
2
3
sudo systemctl enable xrdp
sudo systemctl restart xrdp

Set session to plasma

1
2
echo "/usr/bin/startplasma-x11" > ~/.xsession

store variables for .xsessionrc

1
2
3
4
export D=/usr/share/plasma:/usr/local/share:/usr/share:/var/lib/snapd/desktop
export C=/etc/xdg/xdg-plasma:/etc/xdg
export C=${C}:/usr/share/kubuntu-default-settings/kf5-settings

1
2
3
4
5
6
cat <<EOF > ~/.xsessionrc
export XDG_SESSION_DESKTOP=KDE
export XDG_DATA_DIRS=${D}
export XDG_CONFIG_DIRS=${C}
EOF

fix “authentication required” bug

1
2
3
4
5
6
7
8
9
10
cat <<EOF | \
sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-NetworkManager.pkla
[Netowrkmanager]
Identity=unix-group:sudo
Action=org.freedesktop.NetworkManager.network-control
ResultAny=yes
ResultInactive=yes
ResultActive=yes
EOF

1
2
3
4
5
6
7
8
9
10
cat <<EOF | \
sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-packagekit.pkla
[Netowrkmanager]
Identity=unix-group:sudo
Action=org.freedesktop.packagekit.system-sources-refresh
ResultAny=yes
ResultInactive=auth_admin
ResultActive=yes
EOF

1
sudo systemctl restart polkit