- 安装xrdp服务
sudo apt install -y xrdp
2.把xrdp用户添加证书用户组
adduser xrdp ssl-cert
3.修改/etc/xrdp/startwm.sh 追加配置(解决ubuntu22 连接闪退问题)
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
4.增加 GNOME-ubuntu 配置,获取原生体验
# 创建.xsessionrc 文件
vim ~/.xsessionrc
# 写入
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
5.远程桌面连接时,主机需要注销要登陆的用户,否则远程会黑屏,同理在主机需要登陆时,远程桌面需要注销登陆的用户
6.笔记本合盖休眠问题
6.1. 修改logind.cof 文件
# 编辑操作动作
vim /etc/systemd/logind.conf
# 将原内容,修改为下面的
HandleLidSwitch=lock
HandleLidSwitchExternalPower=lock
HandleLidSwitchDocked=ignore
6.2. WiFi休眠
vim /etc/ppp/options
# 注释下面内容
lcp-echo-interval
lcp-echo-failure
iwconfig
iwconfig 网卡 power off
6.3 系统休眠
# 查看 sleep.target 状态
systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target
# 禁用休眠
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
# 开启休眠
systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target