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.


Reply via email to