Gentoo Archives: gentoo-user

From: Mike Edenfield <kutulu@××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Am I wrong?..
Date: Thu, 01 Oct 2009 20:23:07
Message-Id: 4AC50FA8.90607@kutulu.org
In Reply to: Re: [gentoo-user] Am I wrong?.. by "Arthur D."
1 On 10/1/2009 1:34 PM, Arthur D. wrote:
2 >> I'm using a 4 years old system, and if I change that line, log out and
3 >> in again, it changes the env variable and everything works (that means
4 >> the behavior is probably caused by your configuration). If visudo is
5 >> still using that configuration, maybe that's because some
6 >> configuration file has precedence over environment variables. In that
7 >> case, you gotta find that file and change it.
8 >>
9 >> Not an easy task, anyway... I just did an "grep -r /bin/nano" in /etc.
10 >> LOL, I know there's a better way, I'm just too lazy to look for it...
11 >
12 > Man, running "sudo visudo" and just running "visudo" is not the same.
13 > Be careful. Nano is hardcoded in sudo's ebuild.
14
15 Normal users cannot run "visudo", so you must already be root to run it,
16 or else use 'sudo visudo'. In the first case, it uses your EDITOR
17 variable and there is no problem.
18
19 In the second case, as already explained, it uses the first one of:
20
21 * The EDITOR variable, if you've told sudo to keep it set
22 * The default editor from the sudoers file, if you've set that
23 * The default editor from the ebuild, which is nano.
24
25 It is also not just visudo that has this behavior. Just run this:
26
27 apollo ~ # sudo $EDITOR
28
29 and if you haven't explicitly told sudo to preserve the EDITOR variable
30 it will fail. As will any other program that reads EDITOR (or VISUAL,
31 the other popular one). Point being, the behavior you're seeing isn't a
32 bug in the sudo ebuild --- it's intended and intentional behavior of
33 sudo itself.
34
35 --Mike