[sudo-users] per-user editor for visudo

balducci at units.it balducci at units.it
Sat Jul 30 10:38:38 MDT 2016


hello everybody,

I must be missing some obvious point here, but I can't see where.

It's about setting a per-user editor for visudo.

I seem to understand that a default editor can be set for all users
with (eg):

  Defaults  editor=/usr/bin/emacs

Users are allowed to set their own editor by running "sudo
EDITOR=/usr/bin/nano visudo" when sudoers contains:

  Defaults  env_editor

or:

  Defaults  editor=/usr/bin/emacs:/usr/bin/nano

What I was thinking (and is apparently wrong) is that the editor for
user, say, balducci might also be set like this:

  Defaults:balducci  editor=/usr/bin/nano

without the need for balducci to set any environment variable.

Instead, I find that the editor option in Defaults:balducci is
silently ignored, without any warning/error message from visudo.

In the end: it looks to me that the only way a user has to set an
editor different from the default is via the EDITOR/VISUAL
environment variable (when allowed as per above).

Is this correct? Is there any obvious reason why the editor
option is ignored when in a Defaults:<user> entry?

Again: apologies if I'm not seeing some obvious point

I'll be warmly grateful for any hint/explanation.

And thank you very much for sudo!

ciao
gabriele


If that matters, I build sudo from source with:

    --prefix=${PREFIX}
    --libdir=${PREFIX}/lib
    --libexecdir=${LIBEXECDIR}
    --sysconfdir=${SYSCONFDIR}
    --with-editor=/usr/bin/emacs
    --with-stow
    --without-pam
    --disable-nls


More information about the sudo-users mailing list