admin管理员组文章数量:1571149
--1941508951@qq
由于Ubuntu自带的屏幕分享软件是VNC,而VNC在远程连接的时候,是实时截屏将一帧帧图片传输到控制端,显然效率非常低下,即使使用千兆路由器桥接甚至直接连接网线,延迟都还是很大。RDP对于视频解码的支持更加友好,本文将介绍利用xrdp连接Ubuntu远程桌面。配置好之后,可以无须屏幕直接连接,而且也不会触发显卡休眠出现连接黑屏的情况
2022/07/07更新: 虽然xrdp的分辨率是最高的,但是压缩后的码率还是有些高,导致帧率只有十几二十帧。NoMachine是一款远程桌面连接软件,还支持局域网内自动搜索ip,强烈推荐使用!虽然画质略有一点点点点的损失但是在1920x1080分辨率下还可以达到50-60fps的程度(网络好的情况下)。配置起来也非常非常简单,装好基本就能用。调试的时候有需要还可以直接将你的电脑用网线和目标电脑进行连接。
官网链接:https://www.nomachine
xrdp不太兼容Ubuntu默认的gnome桌面,所以我们需要安装xubuntu-desktop
安装xubuntu-desktop
安装xubuntu-desktop :
sudo apt install xubuntu-desktop
碰到需要选择的地方直接回车
安装xubuntu-desktop 如果失败,那么可以选择换源
换源方法如下:
Ubuntu清华源地址 选择合适的Ubuntu版本
Ubuntu 的软件源配置文件是 /etc/apt/sources.list
先备份原始文件:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
打开软件源配置文件,把软件源配置文件中的内容换成其他源:
sudo gedit /etc/apt/sources.list
随后更新源:
sudo apt-get update
当然也可以直接在 软件与更新 中切换安装源。
安装和配置xrdp
安装xrdp:
sudo apt install xrdp
输入
sudo systemctl status xrdp
验证是否安装成功
成功会出现类似如下内容,按q键退出
● xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: >
Active: active (running) since Tue 2022-03-15 14:05:08 CST; 41min ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Main PID: 810 (xrdp)
Tasks: 1 (limit: 18748)
Memory: 1.4M
CGroup: /system.slice/xrdp.service
└─810 /usr/sbin/xrdp
3月 15 14:05:07 zzy-ThinkPad-T490s xrdp[800]: (800)(139792143402816)[INFO ] add>
3月 15 14:05:07 zzy-ThinkPad-T490s xrdp[800]: (800)(139792143402816)[INFO ] lis>
3月 15 14:05:07 zzy-ThinkPad-T490s xrdp[800]: (800)(139792143402816)[INFO ] xrd>
3月 15 14:05:07 zzy-ThinkPad-T490s xrdp[800]: (800)(139792143402816)[DEBUG] Clo>
3月 15 14:05:07 zzy-ThinkPad-T490s systemd[1]: xrdp.service: Can't open PID fil>
3月 15 14:05:08 zzy-ThinkPad-T490s systemd[1]: Started xrdp daemon.
3月 15 14:05:09 zzy-ThinkPad-T490s xrdp[810]: (810)(139792143402816)[INFO ] sta>
3月 15 14:05:09 zzy-ThinkPad-T490s xrdp[810]: (810)(139792143402816)[INFO ] add>
3月 15 14:05:09 zzy-ThinkPad-T490s xrdp[810]: (810)(139792143402816)[INFO ] lis>
3月 15 14:05:09 zzy-ThinkPad-T490s xrdp[810]: (810)(139792143402816)[INFO ] xrd>
lines 1-21/21 (END)
xrdp 使用 /etc/ssl/private/ssl-cert-snakeoil.key
所以将xrdp添加到ssl-cert用户组中:
sudo adduser xrdp ssl-cert
不放心的话使用这个命令查看一下:
groups xrdp
正常会出现:
xrdp : xrdp ssl-cert
由于安装了xubuntu-desktop ,Ubuntu中存在多个桌面管理器,所以我们需要进行选择。
输入下面的命令将修改写入配置文件,
echo "xfce4-session" >~/.xsession
选择xubuntu-desktop即可。
重启xrdp使配置生效:
sudo systemctl restart xrdp
配置防火墙
如果想从某个IP或者某个范围的IP访问xrdp,例如从192.168.1.77访问xrdp,使用如下命令:
sudo ufw allow from 192.168.1.77 to any port 3389
如果想从任何IP访问则:
xrdp sudo ufw allow 3389
可能会遇到的问题
远程桌面时出现蓝屏,电脑重启后鼠标键盘无法使用
首先重启时进入恢复模式获得root权限
输入:
sudo apt-get install xserver-xorg-input-all
完成再重启即可使用鼠标键盘
再使用如下命令,就应该可以解决蓝屏问题
sudo apt-get install xserver-xorg-core
sudo apt-get install xserver-xorg-input-all
sudo apt-get install xorgxrdp
远程桌面时多次出现要输入密码验证
输入:
sudo gedit /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
把下面这段内容复制粘贴并保存
[Allow Colord all Users] Identity=unix-user:* Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile ResultAny=no ResultInactive=no ResultActive=yes
再输入
sudo gedit /etc/polkit-1/localauthority/50-local.d/46-allow-packagekit.pkla
再把下面这段内容复制粘贴并保存
[Allow Package Management all Users] Identity=unix-user:* Action=org.freedesktop.packagekit.system-sources-refresh ResultAny=yes ResultInactive=yes ResultActive=yes
即可完成配置。
版权声明:本文标题:Ubuntu利用xrdp实现远程桌面连接(局域网可用) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1727688350a1125578.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论