[SunHELP] X-windows trouble

Martin Frost martin at omniconsumerproducts.com
Thu Mar 1 12:16:14 CST 2007

On Thu, 1 Mar 2007, Joe Pampel wrote:

> So the application launches, I have $DISPLAY defined properly (I think),
> and the 'magic cookies' exist for the local machine (Pebbles). I am not
> sure if the cookie really is 'invalid' or what to do about it.

It looks as though you're trying to run the application as a different
user to the one logged in on the machine.

When you log in, a "magic cookie" is generated and stored in your
~/.Xauthority file. This is needed to connect to the X server. This
provides better security than the main alternative, restricting access
purely by host.

There are several approaches you can take:

Most secure: As the user logged in via X, run "xauth list" to list the
authorisation cookies. Find the line you want, and as the user you want to
run the app, run "xauth add $line" (where $line is the relevant line).

Less secure: Copy .Xauthority from the display owner's home directory to
the application runner's directory and adjust ownership etc. This gives
the application runner access to ALL displays that the display owner had
access to (normally this is only one so this is equivalent to the first

Least secure: Run "xhost +localhost" as the display owner, then use
"localhost:0" as the DISPLAY to run the app. This effectively gives any
user running on the host access to the display, so is not very secure. If
this is a private machine with only trusted users, you may be happy with


More information about the SunHELP mailing list