On Wed, Feb 21, 2001 at 09:46:35AM +1000, James Sinnamon wrote:
> 
> 
> 
> Martin,
> 
> Thank you for your suggestion ...
> 
> 
> > Hi,
> >
> > By default the Xserver doesn't listen to the tcp port (for security
> > reasons) and I'll guess thats the reason for your problem. I've added the
> > following few lines to the /root/.bashrc file:
> >
> >    if [ ! "$LOGNAME" = "root" ] ; then
> >         export XAUTHORITY=/home/$LOGNAME/.Xauthority
> >    fi
> >
> > This works for me.
> >
> 
> ... but it didn't work for me.
> 
> Please forgive my ignorance, but I don't really understand what this will
> achieve.
> If I execute 'su -', then $LOGNAME in the child bash shell will be 'root', the
> expression '[ ! "$LOGNAME = "root ]' will evaluate to false, and so nothing 
> will
> 
> happen, as far as I can see.   So I don't see what difference it makes in my
> situation.

I guess, something like the following should work:

su - root -c "export XAUTHORITY=/home/$LOGNAME/.Xauthority; exec /bin/bash -i"

The difference is that LOGNAME gets expanded before you are root.
Put this in a script or create an appropriate alias...

e.g.:

#!/bin/bash
exec /bin/su - root -c "export XAUTHORITY=/home/$LOGNAME/.Xauthority; exec 
/bin/bash -i"

(the syntax for setting XAUTHORITY depends on the login shell flavour,
of course, i.e. whether to use "export..." or "setenv...", etc.)

Cheers,
Erdmut


> >
> > On Wed, 21 Feb 2001, James Sinnamon wrote:
> >
> > > Dear Debian user's,
> > >
> > > My apologies for a question that should have been answered over and over
> > > again on this
> > > list (I have searced but not been able to find an answer),  or if I am
> > > on the wrong  list.
> > >
> > > When I start X Windows, using the KDE window manager, I change to root
> > > (with su - )
> > > for administrative tasks.  However I seem unable to run X window
> > > applications.
> > >
> > > Whatever X application  I try to run, I inevitably get a message similar
> > > to "... unable to open display".
> > >
> > > Previously on other distributions of Linux, I have used, as root :
> > >
> > >     export DISPLAY=localhost:0.0
> > >
> > > and, prior to that,  as the normal user that started the X window
> > > session:
> > >
> > >     xhost localhost
> > >
> > > This somehow doesn;t work on Debian Linux (unstable distribution).
> > >
> > > Would anybody be able to tell me why, and how to go about diagnosing the
> > > problem,
> > > or better still, what to do about it.
> > >
> > > TIA,
> > >
> > > James
> > >
> > > --
> > > James Sinnamon  [EMAIL PROTECTED]
> > >
> > > ph +61 7 46311490, +61 412 319669
> > > PO Box 517 Darling Heights QLD 4350
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 
> --
> James Sinnamon  [EMAIL PROTECTED]
> 
> ph +61 7 46311490, +61 412 319669
> PO Box 517 Darling Heights QLD 4350
> 
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 

-- 
Erdmut Pfeifer
science+computing gmbh
Hagellocher Weg 73              phone: +49 (0)7071-9457-255
D-72070 Tuebingen               email: [EMAIL PROTECTED]

-- Bugs come in through open windows. Keep Windows shut! --

Reply via email to