1 |
On 09/22/2010 09:48 PM, Andrey Vul wrote: |
2 |
> When I launch X programs via sudo, I get the following: |
3 |
> |
4 |
> $sudo gui-admin |
5 |
> No protocol specified |
6 |
> gui-admin: cannot connect to X server :0 |
7 |
> |
8 |
> ( Assume gui-admin is an X program ) |
9 |
> |
10 |
> But (gk|kde)su(do)? works. This is somewhat confusing. |
11 |
|
12 |
I just discovered something. Keeping HOME is not really recommended, |
13 |
because the programs that run as root will then use your user's |
14 |
configuration files and sometimes will set 'root' as their owner. As |
15 |
you can imagine, this is not a good thing. |
16 |
|
17 |
It seems what X programs really need is the .Xauthority file of the |
18 |
current X session. All you have to do is add this line to your ~/.bashrc: |
19 |
|
20 |
export XAUTHORITY="$HOME/.Xauthority" |
21 |
|
22 |
Then you don't have to configure sudoers to keep the HOME env var. |