Problems in setting display variable for X Windows server

Pete Nesbitt pete at linux1.ca
Fri Jun 25 23:43:59 UTC 2004


On June 25, 2004 04:07 pm, santhosh wrote:
> Hi Pete,
>                  Thanks for those responses and forgive me if I am not
> presenting my case clearly; I will make another attempt
>
>
> The Linux Box IP: 192.168.1.10
> Power analyzer installed on : 192.168.1.10 (i.e. same box)
> Application and web server installed on : 192.168.1.10 (i.e. same box)
> Servlets trying to access the X server through the  Display variable
> localhost:0
> Servlets not able to access the X server resulting in failure to display
> charts
> A log is created in the web server with the reason that the servlet cannot
> connect to the X server through the Display variable
>
> I try to set the display variable, or in other words try to figure out
> whats happening with the display variable
>
> So I try the following commands
>
> ***************************************************************************
>* ********************
>    [root at localhost root]# echo $DSIPLAY
>         (blank)
> [root at localhost root]#
>
> even after I give the command export DISPLAY=localhost:0
> ***************************************************************************
>* ********************
> [root at localhost root]#xterm
> Xlib: connection to "localhost:0.0" refused by server
> Xlib: Client is not authorized to connect to Server
> Warning: This program is an suid-root .........
>
> ***************************************************************************
>* ********************
> [root at localhost root]# xhost
> Xlib: connection to "localhost:0.0" refused by server
> Xlib: Client is not authorized to connect to Server
> xhost:  unable to open display "localhost:0"
>
> ***************************************************************************
>* ********************
> [root at localhost root]# xinit
>
> Fatal server error:
> Server is already active for display 0
>         If this server is no longer running, remove /tmp/.X0-lock
>         and start again.
>
> When reporting a problem related to a server crash, please send
> the full server output, not just the last messages.
> Please report problems to xfree86 at xfree86.org.
>
> Xlib: connection to ":0.0" refused by server
> Xlib: Client is not authorized to connect to Server
> giving up.
> xinit:  unable to connect to X server
> xinit:  No such process (errno 3):  Server error.
> [root at localhost root]#
>
>
> Now I am struck with it..being unable to go ahead with my application.
>
>
> Hope that I am presenting my problem clear enough so that you don't have to
> take trouble in understanding problems. Meanwhile I have to appreciate the
> job you people are doing to novices like us
>
>
>
> Thanks
> Santhosh
>
>


Have you tried as a non-root user. I just went to a console, with X still 
running, and as root, I cannot execute an xterm, as a regular user (who ownes 
the current X session) if i export the display as localhost:0, my xterm 
command is displayed in the X environment as expedcted. When I try with a 
differnt user, who does not own the :0 session, then I get:

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

xterm Xt error: Can't open display: localhost:0
---

So it kinda sounds like a permissions thing. You may have tried this, but as 
the user that the servlet is running under, start an X session, then try 
running "xhost + localhost".

When my user 'pete' runs this from within my X session, then my user 'test' 
can successfully display an xterm on the user 'pete' 's X server.

-- 
Pete Nesbitt, rhce





More information about the redhat-list mailing list