Apparently, though unproven, at 15:03 on Sunday 17 October 2010, Nikos 
Chantziaras did opine thusly:

> On 10/17/2010 04:00 PM, Nikos Chantziaras wrote:
> > On 09/22/2010 09:48 PM, Andrey Vul wrote:
> >> When I launch X programs via sudo, I get the following:
> >> 
> >> $sudo gui-admin
> >> No protocol specified
> >> gui-admin: cannot connect to X server :0
> >> 
> >> ( Assume gui-admin is an X program )
> >> 
> >> But (gk|kde)su(do)? works. This is somewhat confusing.
> > 
> > I just discovered something. Keeping HOME is not really recommended,
> > because the programs that run as root will then use your user's
> > configuration files and sometimes will set 'root' as their owner. As you
> > can imagine, this is not a good thing.
> > 
> > It seems what X programs really need is the .Xauthority file of the
> > current X session. All you have to do is add this line to your ~/.bashrc:
> > 
> > export XAUTHORITY="$HOME/.Xauthority"
> > 
> > Then you don't have to configure sudoers to keep the HOME env var.
> 
> (I have the tendency to press the "Send" button too soon...)
> 
> Setting XAUTHORITY in the user's .bashrc also means that you don't have
> to modify /etc/sudoers *in any way*, not even DISPLAY needs to be kept.
>   Setting XAUTHORITY is *all* what is needed.


I owe you a beer :-)

One little export and this annoying thingy has now gone away:

$ sudo vi /etc/fstab 
Password: 
No protocol specified


You have NO IDEA how long that has annoyed me and how long I've been searching 
for a solution. Make that two beers!


-- 
alan dot mckinnon at gmail dot com

Reply via email to