轉自 http://blog.sina.com.cn/s/blog_66719ff30100sdib.html
設置xhost +允許所有的服務器使用當前的X Server,默認情況下,其他服務器是無法訪問本機的X Server,這時如果執行需要圖形化顯示的命令,就會導致上面的Xlib: connection to "172.25.198.226:1.0" refused by server的錯誤。
root用戶下執行#xhost +
看到如下顯示:access control disabled, clients can connect from any host另,我還按照 http://blog.sina.com.cn/s/blog_4d6e44860100lyo2.html 的說法操作了一次,但當時沒有成功。
但是確實設置了一下環境變量。不知道這個環境變量是否有影響。關鍵步驟還是“root用戶下執行#xhost +”
出現錯誤提示:“Xlib: connection to ":1.0" refused by server”
如下處理:
實用技巧:在Linux下設置xhost方法步驟
[root@localhost
~]# vncserver New
'localhost:1(root)' 1desktop is localhost: Starting
applications specified in /root/.vnc/xstartup Log
1.logfile is /root/.vnc/localhost: [root@localhost
1~]# export DISPLAY=localhost: [root@localhost
~]# xhost access
control disabled, clients can connect from any host