Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #199304

Re: /etc/alternatives feedback for presentation

From "der.hans" <deb-user@LuftHans.com>
Newsgroups linux.debian.user
Subject Re: /etc/alternatives feedback for presentation
Date 2018-08-24 04:30 +0200
Message-ID <wqa1j-3oS-1@gated-at.bofh.it> (permalink)
References <wkZpU-7Yo-13@gated-at.bofh.it> <wlKyt-22b-1@gated-at.bofh.it> <wmkLE-6Ct-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Am 13. Aug, 2018 schwätzte Greg Wooledge so:

moin moin,

> 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'.

More than one way...

> 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.

Will this preserve the variables you want?

      --preserve-env=list
                  Indicates to the security policy that the user wishes to
add
                  the comma-separated list of environment variables to
those
                  preserved from the user's environment.  The security
policy
                  may return an error if the user does not have permission
to
                  preserve the environment.

> Isn't Unix *fun*?

Yup :)

> 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?!

I didn't realize su is changing. What's the change?

> 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.

That's what I do. At this point anyone who has the knowledge and desire to
use the shell also knows how to update PATH, no need to give them a
half-baked environment.

> *Fun*!

*WHEEEEEEEE* :)

ciao,

der.hans
-- 
#  https://www.LuftHans.com   https://www.PhxLinux.org
#  "I guess I should've agreed with my boss more often. Today I was replaced
#  by a bobblehead doll!" -- Randy Glasbergen, 13Mar2006

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

/etc/alternatives feedback for presentation "der.hans" <deb-user@LuftHans.com> - 2018-08-09 22:10 +0200
  Re: /etc/alternatives feedback for presentation Ryan Nowakowski <tubaman@fattuba.com> - 2018-08-12 00:30 +0200
    Re: /etc/alternatives feedback for presentation Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-13 15:10 +0200
      Re: /etc/alternatives feedback for presentation David Wright <deblis@lionunicorn.co.uk> - 2018-08-14 17:40 +0200
        Re: /etc/alternatives feedback for presentation Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-14 17:50 +0200
      Re: /etc/alternatives feedback for presentation "der.hans" <deb-user@LuftHans.com> - 2018-08-24 04:30 +0200
        Re: /etc/alternatives feedback for presentation Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-24 14:20 +0200
    Re: /etc/alternatives feedback for presentation "der.hans" <deb-user@LuftHans.com> - 2018-08-17 04:40 +0200

csiph-web