通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/R

您多久访问一次Linux桌面? 您使用什么工具来访问远程桌面?

Xrdp是一个开源工具,允许用户通过Windows RDP访问Linux远程桌面。 除了Windows RDP之外,xrdp工具还接受来自其他RDP客户端的连接,如FreeRDP,rdesktop和NeutrinoRDP。 Xrdp现在支持TLS安全层。

Xrdp要求

xrdp和xorgxrdp包

监听3389/tcp。 确保您的防火墙接受连接

在本文中,我将展示如何使用Xrdp工具从Windows机器远程连接到Ubuntu桌面。

Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redh

1)在Linux上安装 在Ubuntu 18.04/Ubuntu 18.10上

首先,您需要在Ubuntu上安装Xrdp

apt install xrdp

Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redh

您必须配置polkit规则以避免在Windows上的xrdp登录屏幕上输入用户名和密码后进行身份验证弹出窗口

linuxidc@linuxidc:~$ sudo nano /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf

polkit.addRule(function(action, subject) {
if ((action.id == “org.freedesktop.color-manager.create-device” || action.id == “org.freedesktop.color-manager.create-profile” || action.id == “org.freedesktop.color-manager.delete-device” || action.id == “org.freedesktop.color-manager.delete-profile” || action.id == “org.freedesktop.color-manager.modify-device” || action.id == “org.freedesktop.color-manager.modify-profile”) && subject.isInGroup(“{group}”))
{
return polkit.Result.YES;
}
});

Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redh

重启xrdp服务

linuxidc@linuxidc:~$ sudo systemctl restart xrdp

Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redh

然后确保该服务正在运行

linuxidc@linuxidc:~$ systemctl status xrdp
● xrdp.service - xrdp daemon
  Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: ena
  Active: active (running) since Mon 2018-10-29 21:16:31 CST; 2min 0s ago
    Docs: man:xrdp(8)
          man:xrdp.ini(5)
  Process: 5543 ExecStop=/usr/sbin/xrdp $XRDP_OPTIONS --kill (code=exited, statu
  Process: 5565 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SU
  Process: 5557 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, sta
 Main PID: 5566 (xrdp)
    Tasks: 1 (limit: 2305)
  Memory: 1.2M
  CGroup: /system.slice/xrdp.service
          └─5566 /usr/sbin/xrdp

Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redh

现在确保在系统启动时自动启动服务

linuxidc@linuxidc:~$ systemctl enable xrdp
Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable xrdp
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
Failed to reload daemon: Message recipient disconnected from message bus without replying
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
Failed to reload daemon: Message recipient disconnected from message bus without replying
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
Failed to enable unit: Message recipient disconnected from message bus without replying

现在您需要检查您的IP地址,因为您将需要它来进行连接

linuxidc@linuxidc:~$ ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:e4:b3:cf brd ff:ff:ff:ff:ff:ff
    inet 192.168.182.146/24 brd 192.168.182.255 scope global dynamic noprefixroute ens33
      valid_lft 1116sec preferred_lft 1116sec
    inet6 fe80::3f83:c7da:950a:e08/64 scope link noprefixroute
      valid_lft forever preferred_lft forever

我的IP地址是192.168.182.146。 所以请记住。

Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redh

Xrdp使用端口3389,所以一定要打开它。 默认情况下禁用UFW,因此您需要启用防火墙并为xrdp创建规则

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/12391.html