Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 1999 20:44:26 -0500
From:      "Kaleb S. KEITHLEY" <kaleb@ics.com>
To:        dh@enter.net
Cc:        hackers@FreeBSD.ORG
Subject:   Re: X question
Message-ID:  <3699577A.2D857063@ics.com>
References:  <XFMail.990110150928.dh@enter.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Hauer wrote:
> 
> Hi,
>   Quick question., I'm no "X" expert. When I open an xterm, and then su to
> root in it to run an app as root, (cvsup for example) I get an "unable to open
> display localhost:0" error message. What have I missed?

Rather off-topic for FreeBSD-hackers---

Did you log in through xdm? If so, the server only knows the xdm-auth
credentials for you. When you su to root, Xlib looks in root's
~root/.Xauthority file to find credentials and one of three things
happens: 1) there's no ~root/.Xauthority at all, 2) there is a
~root/.Xauthority but there isn't no credential for your $DISPLAY, or 3)
there is a ~root/.Xauthority file, and there is a credential for your
$DISPLAY, but it isn't valid.

The way around this is:

as you: 

 %xauth list 
 ...
 my.host:0 MIT-MAGIC-COOKIE-1  a823117ea138ef897e39ced196d9cb03
 my.host/unix:0 MIT-MAGIC-COOKIE-1  a823117ea138ef897e39ced196d9cb03
 ...

as root:

 %xauth add my.host:0 MIT-MAGIC-COOKIE-1 
a823117ea138ef897e39ced196d9cb0
 %xaut add my.host/unix:0 MIT-MAGIC-COOKIE-1 
a823117ea138ef897e39ced196d9cb03

If there are XDM-AUTHORIZATION-1 credentials copy those as well.

Now root will be able to run X programs in your session.

Once you log out and log back in you'll get new credentials and you'll
need to repeat the above steps again.

--
Kaleb S. KEITHLEY

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3699577A.2D857063>