[SunHELP] X-windows trouble

Joe Pampel joe at ardsley.com
Thu Mar 1 12:29:19 CST 2007

Thanks!!!  That was it.. The xwin session I was in was under root, but
the terminal session was logged in as the user I needed. I thought it
would take the user from the terminal session. I logged out, logged back
in as the user my app runs as and now it works fine. Learn something new
every day..

Much appreciated!  - Joe P

-----Original Message-----
From: sunhelp-bounces at sunhelp.org [mailto:sunhelp-bounces at sunhelp.org]
On Behalf Of Martin Frost
Sent: Thursday, March 01, 2007 1:16 PM
To: The SunHELP List
Subject: Re: [SunHELP] X-windows trouble

On Thu, 1 Mar 2007, Joe Pampel wrote:

> So the application launches, I have $DISPLAY defined properly (I
> and the 'magic cookies' exist for the local machine (Pebbles). I am
> 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
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.
this is a private machine with only trusted users, you may be happy with

SunHELP maillist  -  SunHELP at sunhelp.org

More information about the SunHELP mailing list