[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: su/sudo cannot X



On 1/18/06, Peter McAlpine <peter@aoeu.ca> wrote:
> Security feature or not... when I'm troubleshooting I sometimes want
> this disabled. If 'xhost +' no longer disables all access control, I'd
> be interested in hearing the new way to it.
>
> Thanks,
> -Peter
>
> On Wed, Jan 18, 2006 at 12:17:27AM +0000, Martin OConnor wrote:
> > On Tue, 2006-01-17 at 17:29 -0500, Lei Kong wrote:
> > > Hi,
> > >
> > > I have a strange problem with my thinkpad z60t, running debian testing.
> > > I ran these commands in konsole or xterm under kde:
> > >
> > > $xhost +
> > > $ sudo -s
> > > #kedit
> > > kedit: cannot connect to X server
> > >
> > > What is wrong?
> > > My desktop runs debian testing too, but after su or sudo,
> > > root can open windows even without xhost +.
> > >
> > > xserver-xorg                 6.8.2.dfsg.1-11
> > > sudo                             1.6.8p12-1
> > > kdebase                       3.4.3-3
> > >
> > > Can someone enlighten me?
> > >
> > > Thanks.
> > >
> > > Lei Kong
> > >
> > >
> > This should be considered to be a security feature. X generally does not
> > permit root logins and for the same reason, root (via sudo) cannot
> > access the X system.
> >
> > Thanks,
> > Martin OConnor
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQFDzlyVeeKWVnwTIPIRAvDUAKCCzxxH5X0LtZmBW9nBxbZMao7GSgCgrE8u
> JIoBB3CCsc1WO7Nxy6W5ChE=
> =PiqU
> -----END PGP SIGNATURE-----
>

try putting this in /root/.bashrc:

# allow root to run programs when another
# user is in X
if [ ! "$USER" = "root" ]; then
export XAUTHORITY=/home/$USER/.Xauthority
fi

or just run the export line.  now you should be able to su to root and
run an X11 client locally.

--
Noah Dain
"Single failures can occur for a variety of reasons that have nothing
to do with a hardware defect, such as cosmic radiation ..." - IBM
Thinkpad R40 maintenance manual, page 25



Reply to: