visudo uses nano by default (was Re: I messed up some config files, now all my users have lost sudo priv :( )

Peter Garrett peter.garrett at optusnet.com.au
Thu Jul 5 03:58:32 UTC 2007


On Tue, 03 Jul 2007 13:03:25 -0500
Alex Mauer <hawke at hawkesnest.net> wrote:

> > Both vigr and visudo require a little vi
> > knowledge of course.
> 
> To be more complete, there's also 'vipw' for editing /etc/passwd.  And
> you can select an editor other than vi by setting the VISUAL environment
> variable (i.e. 'VISUAL=nano sudo vigr' will use nano rather than vi)

Actually, by default Ubuntu uses nano for the "visudo" command ( vigr
appears to use vi though).

The setting for "editor" for visudo seems to be whatever is set by the
alternatives system.

sudo update-alternatives --config editor

I noticed this some time back, after I thoroughly confused a user on IRC,
by giving "vi " instructions for visudo - without realising that "visudo"
was actually opening nano :-) 

At the time, I also noticed that installing "mc" changed the
"editor" default to "mcedit" - I don't know whether installing the full vim
version results in a similar takeover !

It would be amusing if installing emacs had similar results - the idea of
typing "visudo" and seeing "emacsudo" would be too much irony to
handle... :-)

Peter






More information about the ubuntu-users mailing list