小工具知识网

当前位置: 首页 > 行业知识 > Windows10使用Xrdp远程桌面连接Ubuntu主机【不稳定】

行业知识

Windows10使用Xrdp远程桌面连接Ubuntu主机【不稳定】

2026-11-05 11:17:26 来源:互联网转载

一、安装桌面环境

Ubuntu 服务器通常使用命令行进行管理,并且默认没有安装桌面环境。如果你正在运行 Ubuntu 桌面版,忽略这一步。

在 Ubuntu 源仓库有很多桌面环境供你选择。一个选择是安装 Gnome,它是 Ubuntu 20.04 的默认桌面环境。另外一个选项就是安装 xfce。它是快速,稳定,并且轻量的桌面环境,使得它成为远程服务器的理想桌面。

运行下面任何一个命令去安装你选择的桌面环境:

安装 Gnome

sudo apt updatesudo apt-get upgradesudo apt install ubuntu-desktop

安装ubuntu-desktop时,选择第一个选项

二、安装 Xrdp

Xrdp 被包含在默认的 Ubuntu 软件源中。想要安装它,运行:

sudo apt install xrdp

一旦安装完成,Xrdp 服务将会自动启动。你可以输入下面的命令,验证它:

sudo systemctl status xrdp

输出将会像下面这样:

● xrdp.service - xrdp daemon

Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)

Active: active (running) since Fri 2020-05-22 17:36:16 UTC; 4min 41s ago

...

三、利用FinalShell登陆远程桌面

  •  允许访问xdrp所在的3389端口:
    sudo ufw allow 3389
    • 如果有多个linux账号,那最好还是直接关闭防火墙:
      sudo ufw disable

      四、查看Ubuntu20.04当前桌面系统

      echo $DESKTOP_SESSION

      五、卸载桌面

      1、卸载xfce

      $sudo apt-get remove xfce4            

      卸载相关软件

                  $sudo apt-get remove xfce4*      

      自动卸载不必要的软件

                   $sudo apt-get  autoremove 

      系统清理

                  $sudo apt-get  clean

      2、卸载xubuntu-desktop

      卸载xubuntu

      $sudo apt-get remove xubuntu*

      同样需要卸载不必要的软件

                   $sudo apt-get  autoremove  

      注意事项:xubutnu附带的应用也会删除,就是xfce或xubuntu下常用的软件也会被卸载。

      3、卸载gnome

      # 卸载gnomesudo apt-get remove gnome -y# 卸载 gnome-shellsudo apt-get remove gnome-shell -y# 彻底卸载删除gnome的相关配置文件sudo apt-get purge gnome -y# 卸载臃肿的服务组件sudo apt-get remove snapd -y# 卸载依赖组件sudo apt-get autoremove -y# 清理安装gnome时候留下的缓存程序软件包sudo apt-get autocleansudo apt-get clean# 重启系统sudo reboot sudo shutdown -r now

      六、ubuntu20.04 关闭图形界面

      关闭用户图形界面,使用xshell登录。

      sudo systemctl set-default multi-user.targetsudo reboot

      开启用户图形界面。

      sudo systemctl set-default graphical.targetsudo reboot

      七、解决重启后桌面环境不能使用root账户登录

      Ubuntu安装桌面环境,桌面简介大方,和win旗鼓相当,消耗性能小。

      在命令环境下运行如下命令:

       apt-get update   //更新软件库 apt-get upgrade   //升级软件 apt-get install ubuntu-desktop    //安装Ubuntu桌面系

       安装时间有点长,需要耐心等待。

      reboot重启后发现桌面环境不能使用root账户登录.

      重启然后使用Ctrl + Alt + F1 进入命令行使用root登陆 

      运行命令

      sudo vi /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf     //打开50-ubuntu.conf

       在末尾添加

      greeter-show-manual-login=true      //允许切换用户登陆allow-guest=false    //禁用Guest  

       完整代码

       [Seat:*] user-session=ubuntu greeter-show-manual-login=true allow-guest=false

      保存重启(在VI模式下编辑完成后使用Esc键切换到末行模式,然后输入:wq退出编辑)发现root用户登陆后还是有警告

      修改/root/.profile文件 (图形界面下修改请勾选显示隐藏文件) 

      将mesg n 替换为 tty -s && mesg n

      完整代码

      # ~/.profile: executed by Bourne-compatible login shells.if [ "$BASH" ]; thenif [ -f ~/.bashrc ]; then   . ~/.bashrcfifitty -s && mesg n || true

       保存后重启即可完美在桌面环境登陆root



      Windows10使用Xrdp远程桌面连接Ubuntu主机_zhwangye的博客-CSDN博客

      Ubuntu Server 20.04 安装桌面(图形界面) 以及 远程桌面

      Ubuntu远程桌面连接——基于xrdp_ubuntu连不上xrdp_三只佩奇不结义的博客-CSDN博客

      15.windows 远程桌面连接Ubuntu20.04(xrdp)_windows远程ubuntu20.04桌面_其木王·王子的博客-CSDN博客

      Ubuntu安装桌面环境_51CTO博客_ubuntu 安装桌面

上一篇:揭秘河马的英语表达,How to Say Hippopotamus in English?

下一篇:基于Android Studio 开发的简易记事本