Gentoo Archives: gentoo-user

From: Nikos Chantziaras <realnc@×××××.de>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: X programs as root
Date: Sun, 17 Oct 2010 13:05:28
Message-Id: i9es75$9ug$2@dough.gmane.org
In Reply to: [gentoo-user] Re: X programs as root by Nikos Chantziaras
1 On 10/17/2010 04:00 PM, Nikos Chantziaras wrote:
2 > On 09/22/2010 09:48 PM, Andrey Vul wrote:
3 >> When I launch X programs via sudo, I get the following:
4 >>
5 >> $sudo gui-admin
6 >> No protocol specified
7 >> gui-admin: cannot connect to X server :0
8 >>
9 >> ( Assume gui-admin is an X program )
10 >>
11 >> But (gk|kde)su(do)? works. This is somewhat confusing.
12 >
13 > I just discovered something. Keeping HOME is not really recommended,
14 > because the programs that run as root will then use your user's
15 > configuration files and sometimes will set 'root' as their owner. As you
16 > can imagine, this is not a good thing.
17 >
18 > It seems what X programs really need is the .Xauthority file of the
19 > current X session. All you have to do is add this line to your ~/.bashrc:
20 >
21 > export XAUTHORITY="$HOME/.Xauthority"
22 >
23 > Then you don't have to configure sudoers to keep the HOME env var.
24
25 (I have the tendency to press the "Send" button too soon...)
26
27 Setting XAUTHORITY in the user's .bashrc also means that you don't have
28 to modify /etc/sudoers *in any way*, not even DISPLAY needs to be kept.
29 Setting XAUTHORITY is *all* what is needed.

Replies

Subject Author
Re: [gentoo-user] Re: X programs as root Alan McKinnon <alan.mckinnon@×××××.com>