Xlib: No protocol specified

轉自 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登陸linux,啓動vnc服務;

第二步:根據vnc起來的端口,設置export DISPLAY=localhost:1(1表示vnc在第一個tty上啓動的),vnc的啓動信息如下:

  1. [root@localhost~]# vncserver  

  2. New 'localhost:1 (root)'desktop is localhost:1

  3. Starting applications specified in /root/.vnc/xstartup  

  4. Log file is /root/.vnc/localhost:1.log  

  5. [root@localhost~]# export DISPLAY=localhost:1

  6. [root@localhost~]# xhost

  7. access control disabled, clients can connect from any host

第三步:執行xhost ,並且提示“accesscontrol disabled, clients can connect from any host”才正確。

關鍵在於用xhost管理Xserver的訪問權限


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章