使用RDP到远程linux计算机可能没有意义。从我的角度来看,速度和性能都不是很好。但是在某些情况下,您可能需要在远程Linux上使用桌面,然后在此发布。

1. CentOS 7

检查系统版本的命令:

匿名-r
cat / proc / version
猫/ etc / os-release
lsb_release -a
注意:lsb_release命令有时在CentOS上不起作用

[[email protected] ~]# 猫/ etc / os-release 
NAME="CentOS 的Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS 的Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="//www.centos.org/"
BUG_REPORT_URL="//bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[[email protected] ~]# cat / proc / version 的Linux version 3.10.0-1062.12.1.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Feb 4 23:02:59 UTC 2020
[[email protected] ~]# 

所有命令:

[[email protected] ~]# rpm -Uvh //dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Retrieving //dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Preparing...                          ################################# [100%]
        package epel-release-7-12.noarch is already installed
[[email protected] ~]# yum update && yum -y install xrdp tigervnc-server
[[email protected] ~]# systemctl enable xrdp && systemctl restart xrdp
Created symlink from /etc/systemd/system/multi-user.target.wants/xrdp.service to /usr/lib/systemd/system/xrdp.service.
[[email protected] ~]# 

[[email protected] ~]# adduser 网络安全
[[email protected] ~]# passwd 网络安全
Changing password for user 网络安全.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
[[email protected] ~]# usermod –aG wheel 网络安全 
[[email protected] ~]# netstat -an | grep 3389
tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN     
[[email protected] ~]# 

注意:您不必将用户netsec添加到wheel组即可通过xRDP登录到远程CentOS服务器。它只是放在这里显示命令。

在线上有很多人在使用xRDP登录CentOS时遇到问题。它似乎已通过身份验证,但在Windows计算机上使用正确的用户名和密码登录CentOS之后,RDP会话立即关闭。那是因为他们缺少“ GNOME桌面”

# yum groups -y install "GNOME Desktop"

或使用重量轻的台式机Xfce:

# yum groups -y install "Xfce"

在记录用户终端下:

nano ~/.Xclients

然后复制& paste:

#!/bin/bash
XFCE="$(which xfce4-session 2>/dev/null)"
exec "$XFCE"

使它可执行:

chmod + x .Xclients

并重新启动xrdp服务器:

sudo服务xrdp重新启动

我仍然不知道如何使它默认为所有用户。

YouTube视频:

2. Ubuntu 18

命令:
sudo apt-get更新
sudo apt-get升级
sudo apt-get install ubuntu-gnome-desktop
须藤apt-get install -y xrdp
sudo sed -i‘s / allowed_users =控制台/ allowed_users =任何人/’/etc/X11/Xwrapper.config
须藤nano /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf

# 须藤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;
}
});
须藤apt-get install gnome-tweak-tool -y

用于在Azure Ubuntu 18.04上安装GNOME桌面GUI和xRDP的YouTube视频:

通过命令行检查服务器的公共IP:

[[email protected] ~]# curl ifconfig.me
35.226.94.252

参考文献

通过 约翰

发表评论