No protocol specified xhost: unable to open display

[weblogic@hdp-01 ~]$ xhost +
No protocol specified
xhost:  unable to open display "192.168.56.1:0.0"
[weblogic@hdp-01 ~]$ env|grep DISPLAY
DISPLAY=192.168.56.1:0.0
[weblogic@hdp-01 ~]$ exit
logout
[root@hdp-01 ~]#  env|grep DISPLAY
DISPLAY=localhost:10.0

然后看看 /etc/hosts 发现了缺失 localhost 

[root@hdp-01 ~]# cat /etc/hosts
192.168.56.129   hdp-01 

[root@hdp-01 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.129   hdp-01
 
OJBK 了
[root@hdp-01 ~]# xhost +
access control disabled, clients can connect from any host
 
 
 
原文地址:https://www.cnblogs.com/vzhangxk/p/11220385.html