[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vipw and vigr default editor



On Fri, Jan 05, 2018 at 03:00:43PM -0500, John Ratliff wrote:
> I have to do
> 
> sudo EDITOR=vim vipw
> 
> How can I make vim the default editor for vipw/vigr. Or how can I set the
> EDITOR variable when I use sudo automatically?

By default, sudo strips all the useful variables out of your environment.
If you want it to *keep* your environment, you need to change the
/etc/sudoers file (with "sudo EDITOR=whatever visudo").  One way to do
it is:

Defaults        env_reset
Defaults:greg   !env_reset
...

where "greg" is the username who is trusted to set environment vars.


Reply to: