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

相关推荐
百思可瑞教育6 分钟前
Spring Cloud Gateway 负载均衡全面指南
运维·负载均衡·北京百思可瑞教育·百思可瑞教育·北京百思教育
hello_ world.16 分钟前
RHCA10NUMA
linux
神秘人X7071 小时前
Linux高效备份:rsync + inotify实时同步
linux·服务器·rsync
轻松Ai享生活1 小时前
一步步学习Linux initrd/initramfs
linux
轻松Ai享生活1 小时前
一步步深入学习Linux Process Scheduling
linux
绵绵细雨中的乡音3 小时前
网络基础知识
linux·网络
Peter·Pan爱编程3 小时前
Docker在Linux中安装与使用教程
linux·docker·eureka
kunge20134 小时前
Ubuntu22.04 安装virtualbox7.1
linux·virtualbox
清溪5494 小时前
DVWA中级
linux
MUY09904 小时前
应用控制技术、内容审计技术、AAA服务器技术
运维·服务器