[sudo-users] per-user editor for visudo

Tony Fondo tony_fondo at nwrdc.fsu.edu
Sat Jul 30 10:43:54 MDT 2016


You could always make an alias for the users, for each shell they would put a respective alias in their respective resource file in their home directory:

Bash .bashrc
Csh   .cshrc etc.

Tony Vincent Fondo, ITIL(r), CISSP(r)
Information Security Manager
Northwest Regional Data Center
Office  (850) 645-3529<tel:(850)%20245-3529>
Cell      (850) 766-7836<tel:(850)%20245-3529>


[CISSP-logo-2lines]


On Jul 30, 2016, at 12:39 PM, "balducci at units.it<mailto:balducci at units.it>" <balducci at units.it<mailto:balducci at units.it>> wrote:

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
____________________________________________________________
sudo-users mailing list <sudo-users at sudo.ws<mailto:sudo-users at sudo.ws>>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-users


More information about the sudo-users mailing list