以root用户运行:xhost +linux
若出现xhost: unable to open display ""app
linux解决xhost: unable to open display ""ide
实用技巧:在Linux下设置xhost方法步骤spa
第一步:用root登录linux,启动vnc服务;日志
第二步:根据vnc起来的端口,设置export DISPLAY=localhost:1(1表示vnc在第一个tty上启动的),vnc的启动信息见下;server
第三步:执行xhost +,而且提示“access control disabled, clients can connect from any host”才正确。ci
linux下的操做日志以下:it
[root@localhost ~]# vncserverio
New 'localhost:1 (root)' desktop is localhost:1class
Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost:1.log
[root@localhost ~]# export DISPLAY=localhost:1
[root@localhost ~]# xhost +
access control disabled, clients can connect from any host
在设置xhost时,出现了unable的问题。使用上诉方法就能够搞定。