内容需要:X Server(192.168.1.200)、X Client(192.168.1.120)
1、配置X Server
第一步:增加一个密纸
[root@Server ~]# xauth add 192.168.1.200:0 . `mcookie`
xauth: creating new authority file /root/.Xauthority
第二步:查看密纸
[root@Server ~]# xauth list
192.168.1.200:0 MIT-MAGIC-COOKIE-1 9d575f6da72892f0e1e498909942b3b7
第三步:通过上面的密纸生成一个密码文件mycookie
[root@Server ~]# xauth extract mycookie 192.168.1.200:0
[root@Server ~]# ls -l mycookie
-rw------- 1 root root 49 Jan 15 22:50 mycookie
第四步:将生成的密码文件mycookie,拷贝到X Client端
[root@Server ~]# scp mycookie 192.168.1.120:$HOME
The authenticity of host '192.168.1.120 (192.168.1.120)' can't be established.
RSA key fingerprint is fe:a2:ef:ab:75:37:04:47:c6:4d:02:9d:58:1c:f7:35.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.120' (RSA) to the list of known hosts.
root@192.168.1.120's password:
mycookie 100% 49 0.1KB/s 00:00
第五步:启动Xorg
[root@Server ~]# X -auth $HOME/.Xauthority &
===================================================================
2、配置X Client
第一步:将X Server传送过来的密码文件mycookie,进行导入操作
[root@Client ~]# ls -l mycookie
-rw------- 1 root root 49 Jan 26 23:21 mycookie
[root@Client ~]# xauth merge mycookie
[root@Client ~]# xauth list
192.168.1.200:0 MIT-MAGIC-COOKIE-1 9d575f6da72892f0e1e498909942b3b7
第二步:配置DISPLAY环境变量
[root@Client ~]# export DISPLAY=192.168.1.200:0
第三步:启动xterm和xeye、twm
[root@Client ~]# xterm &
[root@Client ~]# xeyes &
[root@Client ~]# twm &
===================================================================
3、测试结果
在X Server上会出现如下结果![](https://i-blog.csdnimg.cn/blog_migrate/f6a8f7b6d3168d029110e7cfee2e1bff.jpeg)
注意:做实验之前,确认X Server与X Client都安装了 "GNOME Desktop Enviroment " 与 “ X Window System"