How to setup XRDP server on NanoPC-T4

From FriendlyELEC WiKi
Revision as of 07:27, 17 May 2019 by Tzs (Talk | contribs) (updated by API)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

查看中文

1 Step1: 安装XRDP远程桌面

输入以下命令安装:

sudo apt install -y tigervnc-standalone-server xrdp
sudo sed -e 's/^new_cursors=true/new_cursors=false/g' -i /etc/xrdp/xrdp.ini

2 Step2: 编辑/etc/xrdp/startwm.sh

编辑/etc/xrdp/startwm.sh:

sudo vim /etc/xrdp/startwm.sh

注释掉文件中最后两行 (注释方法:在行首加#号),如下所示:

# test -x /etc/X11/Xsession && exec /etc/X11/Xsession
# exec /bin/sh /etc/X11/Xsession

然后在文件最后添加以下内容:

lxsession -s LXDE -e LXDE

3 Step3: 编辑/etc/xrdp/xrdp.ini

编辑/etc/xrdp/xrdp.ini

sudo vim /etc/xrdp/xrdp.ini

翻页翻到 "; Session types" 的地址,把其他的会话类型全部删除,只剩下[Xvnc]的:

;
; Session types
;
; Some session types such as Xorg, X11rdp and Xvnc start a display server.
; Startup command-line parameters for the display server are configured
; in sesman.ini. See and configure also sesman.ini.
[Xvnc]
name=Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
#xserverbpp=24
#delay_ms=2000

4 Step4: 禁用 light-locker

由于light-locker在XRDP环境下会工作不正常,所以我们需要在XRDP环境下禁用它, 为了不影响真实的环境,这里我们用一个包装脚本来解决,先将原来文件改名:

sudo cp /usr/bin/light-locker /usr/bin/light-locker.orig
sudo rm /usr/bin/light-locker

再创建一个脚本来调用它,用编辑器创建一个文件 /usr/bin/light-locker,内容如下:

#!/bin/sh
 
# The light-locker uses XDG_SESSION_PATH provided by lightdm.
if [ ! -z "\${XDG_SESSION_PATH}" ]; then
  /usr/bin/light-locker.orig
else
  # Disable light-locker in XRDP.
  true
fi
EOF

将脚本给予可执行权限:

sudo chmod 755 /usr/bin/light-locker

5 Step5: 启动xrdp服务

sudo systemctl enable xrdp
sudo systemctl restart xrdp

6 Step6: 测试远程桌面连接

使用Microsoft远程桌面客户端创建一个新连接,地址为开发板的IP地址,用户名与密码是pi,为了获得较好的体验,分辨率建议设置为1280x800,色深为24位色,设置如下图所示:

  • Xrdp-ip.png
  • Xrdp-settings.png

连接成功后如下图所示:
Win-xrdp-friendlydesktop.png