今回は第208回以来約8年ぶりに、
Ubuntuとxrdp
xrdpをめぐる状況は、
第549回で少し取り上げましたが、
もちろんxrdpはHyper-V専用ではありません。Hyper-Vクイック作成を使用しないでUbuntuをインストールした場合は、
今回はUbuntu 20.
なお、
準備
いうまでもありませんがUbuntu 20.
xrdpをインストールするには、
$ sudo apt install xrdp
実はこの状態でもxrdpが使用できますが、

実行するスクリプト
次の内容でシェルスクリプトを作成します。例としてスクリプト名はenhanced-session-mode.
なお前述のとおりlinux-vm-toolsのリポジトリにあるスクリプトを参考にしていますが、
#!/bin/sh
# Add script to setup the ubuntu session properly
if [ ! -e /etc/xrdp/startubuntu.sh ]; then
cat >> /etc/xrdp/startubuntu.sh << EOF
#!/bin/sh
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
exec /etc/xrdp/startwm.sh
EOF
chmod a+x /etc/xrdp/startubuntu.sh
fi
sed -i_orig -e 's/startwm/startubuntu/g' /etc/xrdp/sesman.ini
# rename the redirected drives to 'shared-drives'
sed -i -e 's/FuseMountName=thinclient_drives/FuseMountName=shared-drives/g' /etc/xrdp/sesman.ini
# Changed the allowed_users
sed -i_orig -e 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
# Configure the policy xrdp session
cat > /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla <<EOF
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF
# https://askubuntu.com/questions/1193810/authentication-required-to-refresh-system-repositories-in-ubuntu-19-10
cat > /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla<<EOF
[Allow Package Management all Users]
Identity=unix-user:*
Action=org.freedesktop.packagekit.system-sources-refresh
ResultAny=yes
ResultInactive=yes
ResultActive=yes
EOF
このスクリプトにはあまり解説すべきところはありません。3行目から20行目までがxrdp自体の設定であり、
次のように実行します。
$ sudo bash ./enhanced-session-mode.sh
実行後は再起動してください。なお、

RDPクライアント
Remmina
RDPクライアントを2種類紹介します。まずはUbuntuにインストールされているRemminaです。こちらはバージョンに応じてUIに差異がありますが、
Remminaについては図3を見てもらえばわかるとおり、

「色数」
VPSなどインターネットに直接アクセスできる環境下でRDPを使用する場合は
リモートデスクトップ接続
Windowsにインストールされているリモートデスクトップ接続の場合も、
リモートデスクトップ接続の

「画面」



最近のWindows 10にはsshクライアントがインストールされています。そこで、