LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Xlib: connection to ":0.0" refused by server Xlib: No protocol specified (https://www.linuxquestions.org/questions/linux-newbie-8/xlib-connection-to-0-0-refused-by-server-xlib-no-protocol-specified-152556/)

eyalkz 03-02-2004 08:06 AM

Xlib: connection to ":0.0" refused by server Xlib: No protocol specified
 
hi all,
I'm new here.
I have similar problem with running a C project that uses GLUT/OpenGL graphics...


every run result with the two lines:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

sometimes the graphics works ok sometimes there is an infinite loop, but every execution result with the two lines above.

what is the meaning of these 2 lines?
Is it an Error or Warning?
How can I fix the code?

My guess is that there is a fundamental problem with the graphics Glut Library...Or that I didn't write the MakeFile OK

Please help me, I would extremly appriciate it.
Jonathan:newbie:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

guygriffiths 03-02-2004 10:38 AM

Sounds like you are trying to access X as a non-authorised user.
The only time I ever see those lines is when I have done "su" in a shell and then attempt to run a program.
If this is the problem, then make sure you are the correct user (i.e. the one you originally did startx with or logged in on a graphical login manager with)
If not, then try "xhost +" first.

yodasoda 10-02-2008 11:38 AM

Well first off with:

Xlib: connection to ":0.0" refused by server


to the left of the ':' is suppose to be the address of the windows client that is going to connect to linux Xserver. In my case I had to set an environment variable to it like this


setenv DISPLAY 10.2.55.8:0


this is prolly not what you need but you are definitly missing an ip address

mike.rose 08-04-2009 03:49 AM

Getting X11 forwarding through ssh working after running su
 
X authentication is based on cookies -- secret little pieces of random data that only you and the X server know... So, you need to let the other user in on what your cookie is. One way to do this is as follows:
Before you issue the su or sudo (but after having ssh'ed into the remote system if you are using ssh), request the cookie for the current DISPLAY that's connecting to your X server:

$ xauth list $DISPLAY
You'll get something like

somehost.somedomain:10 mit-magic-cookie-1 4d22408a71a55b41ccd1657d377923ae

Then, after having done su, tell the new user what the cookie is:

$ xauth add somehost.somedomain:10 MIT-MAGIC-COOKIE-1 4d22408a71a55b41ccd1657d377923ae

(just copy and paste the output of the above 'xauth list' onto 'xauth add') That's it. Now, you should be able to start any X application.

A good one to try is:
xclock



xhost # bad
xhost + # very bad

vigi 09-02-2009 01:26 AM

no protocol specified?
 
[QUOTE=mike.rose;3630530]X authentication is based on cookies -- secret little pieces of random data that only you and the X server know... So, you need to let the other user in on what your cookie is. One way to do this is as follows:

---------------------------------------------------------------
Thank you very much. It was annoying to have to change to root rather than access root through the x-terminal.

This worked for me - but how the hell did you figure it out?

rgahockey 05-20-2010 09:31 AM

best explanation so far...
 
Hi,

I just wanted to thank mike.rose for the short but accurate description of how to overcome the problem withe X windows 'refused by server' error. It not only worked, but it now makes more sense.

Thanks,

Russ.

mike.rose 05-24-2010 03:02 AM

reference to the answer
 
Thanks for the thanks. I should have included the reference to the answer I found and posted here:
http://www.debian-administration.org/articles/494

The other reference is my "yoda" Michael Rutter who taught me about X11 and cookies:
http://www.tcm.phy.cam.ac.uk/~mjr/

anthalamus 09-01-2010 10:07 AM

Of course a lazy way to get around this is to use ssh -X... for instance:

Code:

ssh your_user_that_wants_to_use_x@localhost -X
I heard sux does a good job at this as well, haven't tried though

creative 12-21-2011 07:52 PM

I have a sort of similar problem.
I have VNCed to a machine, when logged in as the default user I am able to start xwindows, but as soon as I login as root.. export DISPLAY and try to open a xwindow I get this error:

[root@patton:/] xclock
Xlib: connection to "patton:6.0" refused by server
Xlib: No protocol specified

Error: Can't open display: patton:6

when I ssh from my local windows machine to the same host and use Cygwin for xWindow to connect to it.I am able to start the x-window on my local machine as a root,

ON VNC I tried above suggested command when logged in as a default user
xauth list $DISPLAY
but it returns nothing to me.

Appreciate your help !

funkyworklehead 04-18-2012 03:41 PM

Hi creative,

I had the same symptoms as you -- not seeing any entries from `xauth list $DISPLAY`. From the xauth man page it looks like you can do this to generate an xauth key for your display:

Quote:

xauth $DISPLAY .
That worked for me.

adithyagokhale 02-07-2014 12:53 AM

Thanks guys.. :)
 
This solution helped me too. thanks a lot mike.rose ..:)

JockVSJock 04-22-2015 09:17 AM

Was having an issue with this and LinuxQuestions saves the day again.

thanks

jorgemop 11-27-2018 01:30 PM

Mike Rose, i coming from near future and your post rule in this year. Thanks for your help i coming early to home.


All times are GMT -5. The time now is 08:14 AM.