How are these 2 variables used by the X Window system?

On my Ubuntu 9.10 host, if I set XAUTHORITY to anything and then try to run a GUI program, I receive a GTK-WARNING ***: cannot open display :0.0 (DISPLAY is set to :0.0 by default). What is causing this error message?


DISPLAY is used by the X Window System to specify the host, graphics controller, and physical display. The default :0.0 means local host (frequently a Unix domain socket instead of a TCP/IP socket), first graphics controller and first physical display attached (0 for both). If you were connecting to an X server on a different host, you would specify that host's name or IP address; if you were using a different controller or display you would specify that number.

XAUTHORITY is used by xauth (as mentioned by c4747p) and contains the name of the file with your X privilege tokens.

You are probably getting the message because a bad XAUTHORITY file leads one to have no permissions to attach to the X server.


DISPLAY tells a program which "display" to run on (Linux typically has multiple virtual consoles). :0 is the default one; you can configure more. XAUTHORITY is related to the xauth system. The xauth system manages privileges for connecting to the X server, which runs as root. Because the program cannot find the authority file that it thinks you're specifying in XAUTHORITY, it can't get permission to connect.


c4757p is correct.

The specific reason why you can't launch GUI programs after setting XAUTHORITY is, it already has a value (assigned automatically by your display manager program when you log in,) and if you tamper with that, you'll get problems changing authorization. You would still be able to launch programs, but running anything as a different user would be a problem (so any administrative programs wouldn't launch.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy