LinuxSSH转发GUI

no alter data available

Linux SSH转发GUI

2022/11/20

linux

测试环境

Centos 7 xhell xming

配置环境

yum install -y xhost 将会自动配置xorg zMb7DS.png

进入配置文件

sudo vim /etc/ssh/sshd_config

修改以下配置,如果在配置文件里面没有找到,就直接添加到文件末尾即可,最后保存退出:wq

X11Forwarding yes X11DisplayOffset 10 X11UseLocalhost yes 本地下载#安装xming 启动xming.1启动xming.2

红框中的选项首次可以不选择,如果结果出现异常请返回这里勾选

桌面右下角出现x图标则表示xming正常运行

返回到xshell 配置转发端口

root@xxx ~# export DISPLAY=本机ip:0.0 本机IP可以通过命令行输入ipconfig 请先在服务器端ping一下本机ip,测试连通性

ping -c 4 本机ip #测试 [roor@xxx~]#xhost + 出现access control disabled, clients can connect from any host时成功运行 接下来以xclock为例

roor@xxx~#xclock Xclock #常见错误:

  1. cannot display'' 解决方法:添加端口 export DISPLAY=本机ip:0.0
  2. no protocol specified 解决方法:xhost + 若仍报异常则不是此处问题
  3. xming 日志文件 client 4 reject from ip 解决方法:修改x*.host文件,添加一行本机ip client 4 reject from ip xxxx解决方法:启动xming 时勾选
    No Access Control

Chen Xingyu

Hi! I am Chen Xingyu, a Tech enthusiast, problem solver and software engineer. Currently finishing my bachelor's degree in Geographic Information Science.

Connect With Me

I have a fair amount of knowledge of Javascript, Typescript, VueJs, and Nuxt. If you have an interesting idea, either open source or paid let's connect.

Sent Mail
© 2017-2025 All Right is reserved. 🤷‍♂️ It's open source anyway.