On Mon 13 Aug 2018 at 09:08:28 (-0400), Greg Wooledge wrote: > On Sat, Aug 11, 2018 at 05:28:37PM -0500, Ryan Nowakowski wrote: > > For example if I set the EDITOR env var how does > > that interact with update-alternatives when I run visudo? > > The VISUAL or EDITOR variable takes precedence, if one of them is set. > If neither one is set, then visudo uses its compiled-in default, which > on Debian happens to be '/usr/bin/editor'. > > The problem is that sometimes, sudo will strip environment variables, > and sometimes, it will not. So, on any given computer with any given > sudoers configuration, you can't actually know in advance whether > "sudo visudo" will use VISUAL/EDITOR or not. > > Isn't Unix *fun*? > > Of course, if you simply use "su", then VISUAL/EDITOR will be preserved > in the environment (because "su" does not strip environment variables), > so "su" followed by "visudo" should work fine. > > But, wait! Debian has decided to CHANGE HOW SU WORKS in testing, so > after stretch, who knows how things will work?! > > Some people claim you should muscle-memorize "su -" which strips the > environment in order to give you a usable PATH variable. If you follow > THIS advice, then "su -" will strip VISUAL/EDITOR from the environment, > and then your VISUAL/EDITOR variables won't work when you type visudo. > So, I can't imagine why you would want to do that. Losing all your > qualify-of-life environment variables is far too high a price to pay to > get a working PATH variable after su. > > The other alternatives are: > > 1) Stay on stretch. > 2) Edit /etc/login.defs to restore a functional su command (without needing > to use "su -"). > 3) Put /usr/sbin and /sbin in your ordinary account's PATH. > > *Fun*!
Why is Put some "qualify-of-life environment variables" into /root/.bashrc not in your list? Cheers, David.