LoginSignup
9
5

More than 3 years have passed since last update.

Ubuntu 18.04.4 DesktopにWindowsからRDP接続

Posted at

前書き

Ubuntu 18.04.4 DesktopにRDP接続したかっただけなのに、いろいろ躓いたのでまとめる。

HWEをGEに入れ替える

Ubuntu 18.04 DesktopにはHWEが入っているがこれがあると後でインストールするxrdpが動かなくなる。なのでxrdpをインストールする前にHWEをGEに入れ替える。
参考サイト

sudo telinit 3 #コンソールログイン
apt update
apt -y purge ubuntu-desktop xorg # xorgを入れ替えるのでpurge
apt install linux-generic # GEカーネルインストール
apt purge linux-generic-hwe-18.04 # HWEカーネル削除
reboot
sudo telinit 3
apt purge xserver-xorg-core-hwe-18.04 xserver-xorg-input-all-hwe-18.04 xserver-xorg-legacy-hwe-18.04 linux-headers-generic-hwe-18.04 linux-image-generic-hwe-18.04 # HWE関連パッケージ削除
dpkg -l | grep hwe # HWE関連パッケージが残っていないか確認、あれば削除
apt install xserver-xorg-core
apt install ubuntu-desktop xserver-xorg xserver-xorg-video-all xserver-xorg-input-all libgl1-mesa-dri libgl1-mesa-glx
reboot

xrdpをインストールする

参考サイト1
参考サイト2

sudo apt install xrdp
cat <<EOF > ~/.xsessionrc
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop
export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
EOF
sudo sed -e 's/^new_cursors=true/new_cursors=false/g' -i /etc/xrdp/xrdp.ini

cat <<EOF | \
sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-color-manager.pkla
[Netowrkmanager]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF

sudo reboot

xrdpユーザをssl-certに追加する

このままだとCannot read private key file /etc/xrdp/key.pem: Permission denied
とエラーログが出るので権限を追加する

sudo gpasswd -a xrdp ssl-cert

RDPからログインするユーザをログアウトする

RDP以外からログインしているとRDP接続できないようなのでRDP以外からはログアウトする

9
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
5