5
7

More than 3 years have passed since last update.

ubuntu20.04にリモートデスクトップ接続

Last updated at Posted at 2020-07-30

はじめに

Ubuntu20.04にリモートデスクトップ接続するための手順です。

手順

xrdpのインストール

下記コマンドでxrdpをインストールします。

$ sudo apt install xrdp

これでリモートデスクトップ接続できます。

linux-vm-toolsのインストール

xrdpだけでリモートデスクトップ接続できるのですが、左側にDockが表示されないなど、少し気持ち悪い状態でした。これはlinux-vm-toolsをインストールすることで解決するらしいです。第621回 Ubuntu 20.04 LTSでxrdpを使用する

GitHub - microsoft/linux-vm-toolsの手順に従ってインストールしました。

$ sudo apt install git
$ git clone https://github.com/microsoft/linux-vm-tools.git
$ cd linux-vm-tools
$ git fetch --all
$ git pull origin pull/106/head:pull_106
$ git checkout pull_106
$ cd ubuntu/20.04/
$ sudo bash ./install.sh

あまり意味はなかった気がしますが、手順に従い、再起動後に再度シェルを実行しました。

$ sudo bash ./install.sh

再び再起動しました。

この状態では、xrdpデーモンがエラー(trans_listen_address failed)を吐いていましたので、下記の通りxrdp.iniを書き換えました。

/etc/xrdp/xrdp.ini(変更前)
port=vsock://-1:3389
/etc/xrdp/xrdp.ini(変更後)
port=3389

xrdpデーモンを起動しました。

$ sudo systemctl start xrdp

その他

ルートユーザでGUIを起動する

ルートユーザでGUIを起動する際は、ルートユーザに起動中のX Serverへのアクセス権を付与する必要がありました。そのまま実行するとエラー(Cannot open display)が表示されました。Cannot open display #787

$ xhost +SI:localuser:root
5
7
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
5
7