Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: X programs as root
Date: Sun, 17 Oct 2010 16:20:46
Message-Id: 201010171737.14503.alan.mckinnon@gmail.com
In Reply to: [gentoo-user] Re: X programs as root by Nikos Chantziaras
1 Apparently, though unproven, at 15:03 on Sunday 17 October 2010, Nikos
2 Chantziaras did opine thusly:
3
4 > On 10/17/2010 04:00 PM, Nikos Chantziaras wrote:
5 > > On 09/22/2010 09:48 PM, Andrey Vul wrote:
6 > >> When I launch X programs via sudo, I get the following:
7 > >>
8 > >> $sudo gui-admin
9 > >> No protocol specified
10 > >> gui-admin: cannot connect to X server :0
11 > >>
12 > >> ( Assume gui-admin is an X program )
13 > >>
14 > >> But (gk|kde)su(do)? works. This is somewhat confusing.
15 > >
16 > > I just discovered something. Keeping HOME is not really recommended,
17 > > because the programs that run as root will then use your user's
18 > > configuration files and sometimes will set 'root' as their owner. As you
19 > > can imagine, this is not a good thing.
20 > >
21 > > It seems what X programs really need is the .Xauthority file of the
22 > > current X session. All you have to do is add this line to your ~/.bashrc:
23 > >
24 > > export XAUTHORITY="$HOME/.Xauthority"
25 > >
26 > > Then you don't have to configure sudoers to keep the HOME env var.
27 >
28 > (I have the tendency to press the "Send" button too soon...)
29 >
30 > Setting XAUTHORITY in the user's .bashrc also means that you don't have
31 > to modify /etc/sudoers *in any way*, not even DISPLAY needs to be kept.
32 > Setting XAUTHORITY is *all* what is needed.
33
34
35 I owe you a beer :-)
36
37 One little export and this annoying thingy has now gone away:
38
39 $ sudo vi /etc/fstab
40 Password:
41 No protocol specified
42
43
44 You have NO IDEA how long that has annoyed me and how long I've been searching
45 for a solution. Make that two beers!
46
47
48 --
49 alan dot mckinnon at gmail dot com

Replies

Subject Author
Re: [gentoo-user] Re: X programs as root Kevin O'Gorman <kogorman@×××××.com>