Ubuntu 使用 XRDP 实现远程桌面连接

1.安装XRDP

首先,需要在Ubuntu上安装XRDP。打开终端,输入以下命令进行安装:

bash 复制代码
sudo apt updatesudo apt install xrdp

2.检查XRDP是否安装成功:

bash 复制代码
xrdp --version

3.连接黑屏

本机没有注销的话,远程桌面就会黑屏----->退出本地登录,也就是注销登录

别的一些解决方案,但是这个放在在Ubuntu 22中会导致闪退。即,编辑 /etc/xrdp/startwm.sh 文件:

  1. 打开文件
bash 复制代码
sudo vim /etc/xrdp/startwm.sh
  1. 添加配置
bash 复制代码
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
  1. 重启xrdp服务
bash 复制代码
sudo systemctl restart xrdp.service

4.桌面优化

先修改下面配置文件,再远程连接,否则会黑屏,这个时候需要重启

  1. 添加配置文件
bash 复制代码
vim ~/.xsessionrc

添加:

bash 复制代码
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
  1. 重启xrdp服务
bash 复制代码
sudo systemctl restart xrdp.service

5.Xrdp 体验优化 减少/解决画面卡顿

调整 Xrdp 配置参数

编辑 /etc/xrdp/xrdp.ini

bash 复制代码
tcp_send_buffer_bytes=4194304
tcp_recv_buffer_bytes=6291456

tcp_send_buffer_bytes, tcp_recv_buffer_bytes 两个参数默认被注释了,注释默认值(32768),根据实际情况进行调整。

调整系统参数

临时生效

bash 复制代码
sudo sysctl -w net.core.rmem_max=12582912
sudo sysctl -w net.core.wmem_max=8388608

重启后保留

将以下内容写入配置文件 /etc/sysctl.conf

bash 复制代码
net.core.rmem_max = 12582912
net.core.wmem_max = 8388608

然后执行

bash 复制代码
sudo sysctl -p

重启 xrdp 服务生效

bash 复制代码
sudo systemctl restart xrdp

原文:https://cloud.tencent.com/developer/article/2355160

相关推荐
zzzzzz3107 小时前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode7 小时前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
用户0328472220701 天前
如何搭建本地yum源(上)
运维
A小辣椒2 天前
TShark:Wireshark CLI 功能
linux
A小辣椒2 天前
TShark:基础知识
linux
AlfredZhao2 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao3 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334663 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪3 天前
linux 拷贝文件或目录到指定的位置
linux
大树884 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai