sudo + X problem? (was:Re: dapper settings has miscellaneous
simon at simonzone.com
Fri Feb 17 07:32:55 GMT 2006
On Friday 17 February 2006 00:46, Achim Bohnet wrote:
> On Thursday 16 February 2006 08:46, Simon Edwards wrote:
> form earlier in the thread:
> >> What does "sudo echo $DISPLAY" give?
> The $DISPLAY is expanded by user shell
> _before_ sudo is executed. I would suggest comparing output of
Right you are. I've been comparing the results of "env" and "sudo env" on
breezy and dapper and I can't see what the difference is. strace is telling
me that the problem is finding the .Xauthority file.
> > Just some more info that I've found by using strace.
> > Running 'displayconfig' and 'sudo displayconfg' on breezy both
> > use /home/sbe/.Xauthority. But doing 'displayconfig' on dapper
> > uses /home/sbe/.Xauthority while 'sudo displayconfg' tries to use
> > '/root/.Xauthority'!
> Hmm, then $HOME gets maybe redefined? That's one way how it can
> go wrong (see man xauth. Section FILES and ENVIRONMENT and -f)
$HOME stays on /home/sbe/, which is correct. Doing "export
XAUTHORITY=/home/sbe/.Xauthority" before running "sudo displayconfig" does
fix the problem. As suggested by Rajeev, kdesu does work too. (It appears to
make a temporary .Xauthority in /tmp and then set $XAUTHORITY).
> > My python code uses the C function XOpenDisplay() to open the X display.
> > (DISPLAY=:0.0)
What boogles my noggin is that running "sudo konsole" works, but with quite a
few complaints that the X server can't be reached. ("sudo konsole"
automatically starts up a bunch of othe kde daemons and programs for the root
user). "sudo xterm" also works fine and can find /home/sbe/.Xauthority. So I
don't know what I'm doing wrong here, or if the toolkits have their own code
for setting handling xauthority...
Simon Edwards | KDE-NL, Guidance tools, Guarddog Firewall
simon at simonzone.com | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."
More information about the kubuntu-devel