On 10/1/2009 1:34 PM, Arthur D. wrote:
I'm using a 4 years old system, and if I change that line, log out and
in again, it changes the env variable and everything works (that means
the behavior is probably caused by your configuration). If visudo is
still using that configuration, maybe that's because some
configuration file has precedence over environment variables. In that
case, you gotta find that file and change it.

Not an easy task, anyway... I just did an "grep -r /bin/nano" in /etc.
LOL, I know there's a better way, I'm just too lazy to look for it...

Man, running "sudo visudo" and just running "visudo" is not the same.
Be careful. Nano is hardcoded in sudo's ebuild.

Normal users cannot run "visudo", so you must already be root to run it, or else use 'sudo visudo'. In the first case, it uses your EDITOR variable and there is no problem.

In the second case, as already explained, it uses the first one of:

* The EDITOR variable, if you've told sudo to keep it set
* The default editor from the sudoers file, if you've set that
* The default editor from the ebuild, which is nano.

It is also not just visudo that has this behavior.  Just run this:

apollo ~ # sudo $EDITOR

and if you haven't explicitly told sudo to preserve the EDITOR variable it will fail. As will any other program that reads EDITOR (or VISUAL, the other popular one). Point being, the behavior you're seeing isn't a bug in the sudo ebuild --- it's intended and intentional behavior of sudo itself.

--Mike





Reply via email to