转载:Xlib: No protocol sp…

I visited in linux db2cc, appears Xlib: No protocol specified error

switched http://blog.sina.com.cn/s/blog_66719ff30100sdib.html

Set xhost + to allow all servers to use the current X Server . By default, other servers cannot access the local X Server . At this time, if you execute commands that require graphical display, it will cause the above Xlib: connection to "172.25 .198.226:1.0" refused by server error.

Execute #xhost + under root user

I saw the following display: access control disabled, clients can connect from any host. In

addition, I also followed the statement http://blog.sina.com.cn/s/blog_4d6e44860100lyo2.html to operate once, but did not succeed at that time.
But it does set some environment variables. I don't know if this environment variable has any effect. The key step is to " execute #xhost + under root user "

An error message appears: "Xlib: connection to ":1.0" refused by server"

Treat as follows:

Practical skills: Steps to set up xhost method under Linux

   The first step: Log in to Linux as root and start the vnc service;

    Step 2: Set export DISPLAY=localhost:1 (1 means vnc is started on the first tty) according to the port where vnc is up. The startup information of vnc is as follows:

  1. [root@localhost ~]# vncserver   
  2.   
  3. New 'localhost:1 (root)' desktop is localhost:1  
  4.   
  5. Starting applications specified in /root/.vnc/xstartup   
  6. Log file is /root/.vnc/localhost:1.log   
  7.   
  8. [root@localhost ~]# export DISPLAY=localhost:1    
  9. [root@localhost ~]# xhost    
  10. access control disabled, clients can connect from any host  
[root@localhost ~]# vncserver

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

Starting applications specified in /root/.vnc/xstartup
Log 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

  

   Step 3: Execute xhost and prompt " access control disabled, clients can connect from any host" is correct. 

 

 The key is to use xhost to manage Xserver access permissions


Guess you like

Origin blog.csdn.net/muzhiqian/article/details/52669931