本文最后更新于:2023年12月7日 下午

在 Ubuntu 系统远程 Ubuntu 服务器时,无法直接显示服务器 GUI 信息,本文记录改进方法。

配置方法

远程 Ubuntu

  1. 安装 ssh server

    1
    apt install openssh-server
  2. 修改 /etc/ssh/sshd_config 文件

    1
    2
    3
    PermitRootLogin yes
    X11Forwarding yes
    X11UseLocalhost no
  3. 重启ssh服务

    1
    service ssh restart

本地 Ubuntu

  1. 开放 xHost 显示权限

    1
    xhost +
  2. 以 支持 X11 转发的模式建立 SSH 连接

    1
    ssh -X root@远程IP -p 远程端口
  3. 如果不方便在 SSH 命令中加入 -X 参数,可以在远程连接配置中加入 ForwardX11 yes

    例如

    1
    2
    3
    4
    5
    6
    7
    Host rknntest
    HostName localhost
    User root
    Port 5638
    IdentityFile /home/vvd/.ssh/id_rsa.pub
    IdentitiesOnly yes
    ForwardX11 yes

之后可以本地显示远程GUI了,可以用 xclock 命令测试

这时候也能看到

1
2
$ echo $DISPLAY
838b7433ddf7:10.0

DISPLAY 变量被自动赋值

参考资料



文章链接:
https://www.zywvvd.com/notes/system/linux/ubuntu-remote-gui/ubuntu-remote-gui/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

Ubuntu 显示远程 Ubuntu 服务器 GUI
https://www.zywvvd.com/notes/system/linux/ubuntu-remote-gui/ubuntu-remote-gui/
作者
Yiwei Zhang
发布于
2023年12月7日
许可协议