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

1.安装XRDP

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

sudo apt updatesudo apt install xrdp

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

xrdp --version

3.连接黑屏

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

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

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

4.桌面优化

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

  1. 添加配置文件
vim ~/.xsessionrc

添加:

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

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

调整 Xrdp 配置参数
编辑 /etc/xrdp/xrdp.ini

tcp_send_buffer_bytes=4194304
tcp_recv_buffer_bytes=6291456

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

调整系统参数
临时生效

sudo sysctl -w net.core.rmem_max=12582912
sudo sysctl -w net.core.wmem_max=8388608

重启后保留

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

net.core.rmem_max = 12582912
net.core.wmem_max = 8388608

然后执行

sudo sysctl -p

重启 xrdp 服务生效

sudo systemctl restart xrdp

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

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-22 00:42:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-22 00:42:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-22 00:42:02       82 阅读
  4. Python语言-面向对象

    2024-03-22 00:42:02       91 阅读

热门阅读

  1. 【教你如何制作一个简单的HTML个人网页】

    2024-03-22 00:42:02       48 阅读
  2. Linux入门:常用基本命令

    2024-03-22 00:42:02       37 阅读
  3. MySQL WITH AS 方法创建临时表的技术详解

    2024-03-22 00:42:02       39 阅读
  4. 【算法】棋盘(模板题)

    2024-03-22 00:42:02       41 阅读