-   Linux - General (
-   -   Root problems with X (

blueplazma 08-31-2002 11:23 PM

Root problems with X
When I try to run a program that runs in X as root from a terminal I get this error:

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

Gtk-WARNING **: cannot open display :0.0

and then nothing happens.

Also... can anyone tell me where exactly blocked packets from iptables would be logged? Thanks.

Mara 09-01-2002 11:33 AM

You can't run a program from the terminal. Instead, run X (startx) and you can run programs from terminals, but from terminals running in X.

nxny 09-01-2002 09:59 PM

Sounds like the X server is running - it was startx-ed by someone else.

Any other user ( not even root) cannot USE the services offerered by the X server unless the client program authenticates with the server. Unless, we have the MIT-MAGIC-COOKIE in the server user's ~/.Xauthority. this is the cookie that the Xserver starts with and all clients are supposed to use to connect to it.

Since it is root who wants to connect, and root can read any file in the system it that makes it a li'l easier for you to deal with this.

Run the command as root right before you run the x client prog. You are extracting the cookie that the X server was instructed to authenticate with ( when someguy started the server ) and adding it to root's cookie file.
xauth -f ~someguy/.Xauthority list :0.0 | awk '{ printf("add :0.0 . %s",$NF); }' | xauth -q
see man xauth

blueplazma 09-01-2002 10:00 PM

I am running this from a terminal within X. Sorry I wasn't specific about that.

nxny 09-01-2002 10:02 PM

Yeah, I thought so. You're probably using su - from within xterm

aliensub 10-27-2002 07:11 PM

I have discovered that this happens if you use kdm or xdm (haven't tried with gdm). When i used i didn't have this problem, but if i used xdm it appeared.

moses 10-27-2002 11:28 PM

To allow other users (even root) to access your X session, use:

xhost +localhost

Then make sure your other user has their environment DISPLAY set
correctly (looks like it above) by either:
setenv DISPLAY localhost:0.0
export DISPLAY=localhost:0.0

Then run your X program. . .

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