Re: /etc/alternatives feedback for presentation

2018-08-24 Thread Greg Wooledge
On Fri, Aug 24, 2018 at 02:26:19AM +, der.hans wrote:
> Am 13. Aug, 2018 schwätzte Greg Wooledge so:
> > 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?

 is just
one of several threads that discussed it recently.



Re: /etc/alternatives feedback for presentation

2018-08-23 Thread der.hans

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


*WH* :)

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

Re: /etc/alternatives feedback for presentation

2018-08-16 Thread der.hans

Am 11. Aug, 2018 schwätzte Ryan Nowakowski so:

moin moin Ryan,


On Thu, Aug 09, 2018 at 08:08:00PM +, der.hans wrote:

moin moin,

I'm giving a presentation on /etc/alternatives in a few hours.

If you use the alternatives system a lot and would like to spend a few
minutes reviewing my talk for me, please see the links below.

Any use cases or cool functionality that I've missed?

Anything I've gotten completely wrong?

Any suggestions for good examples?

AsciiDoc source file:

https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.adoc

Slidy HTML ( one-page format without JavaScript, slides with JavaScript ):

https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.html



You might add more info on how the other methods interact with
update-alternatives.  For example if I set the EDITOR env var how does
that interact with update-alternatives when I run visudo?  In fact I
think something like a "best practices" is needed for setting default
programs and then overriding them on a per user basis.  I'm not sure
this presentation is the right place for that but perhaps it could be
a wiki page in the future.


Yeah, I think I need to write/update an article on how they are used and
in what order they're evaluated. That would actually be a good resource
for my anatomy of the command line presentation as well.

I also need more examples.

ciao,

der.hans
--
#  https://www.LuftHans.com   https://www.PhxLinux.org
#  "Rock 'n' roll might not solve your problems, but it does let you dance
#  all over them." -- Pete Townsend
fred

Re: /etc/alternatives feedback for presentation

2018-08-14 Thread Greg Wooledge
On Tue, Aug 14, 2018 at 10:31:02AM -0500, David Wright wrote:
> On Mon 13 Aug 2018 at 09:08:28 (-0400), Greg Wooledge wrote:
> > 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.

> Why is
> 
>  Put some "qualify-of-life environment variables" into /root/.bashrc
> 
> not in your list?

I guess that would work, but I see some flaws:

 a) Every time you change an environment variable in your personal
account, you'll need to remember to make the same change in root's
account.

 b) What if other people also have root access to this system and don't
want your personal variables?

 c) If you need to make a change on every machine as root to fix the
behavior, why not just change /etc/login.defs instead?

 d) Especially if your home directory is shared across many systems.
Changing it just once in your home directory is better than having
to change every single system you log into.

Still, feel free to come up with your own alternatives to make things
work.  You might find some more ideas that I overlooked.



Re: /etc/alternatives feedback for presentation

2018-08-14 Thread David Wright
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.



Re: /etc/alternatives feedback for presentation

2018-08-13 Thread Greg Wooledge
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*!



Re: /etc/alternatives feedback for presentation

2018-08-11 Thread Dale Forsyth
https://www.mycause.com.au/page/183259/a-smile-will-change-a-day-love-that-changed-my-world

From: Ryan Nowakowski 
Sent: Sunday, 12 August 2018 8:28 AM
To: debian-user@lists.debian.org
Subject: Re: /etc/alternatives feedback for presentation

On Thu, Aug 09, 2018 at 08:08:00PM +, der.hans wrote:
> moin moin,
>
> I'm giving a presentation on /etc/alternatives in a few hours.
>
> If you use the alternatives system a lot and would like to spend a few
> minutes reviewing my talk for me, please see the links below.
>
> Any use cases or cool functionality that I've missed?
>
> Anything I've gotten completely wrong?
>
> Any suggestions for good examples?
>
> AsciiDoc source file:
>
> https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.adoc
>
> Slidy HTML ( one-page format without JavaScript, slides with JavaScript ):
>
> https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.html
>

You might add more info on how the other methods interact with
update-alternatives.  For example if I set the EDITOR env var how does
that interact with update-alternatives when I run visudo?  In fact I
think something like a "best practices" is needed for setting default
programs and then overriding them on a per user basis.  I'm not sure
this presentation is the right place for that but perhaps it could be
a wiki page in the future.



Re: /etc/alternatives feedback for presentation

2018-08-11 Thread Ryan Nowakowski
On Thu, Aug 09, 2018 at 08:08:00PM +, der.hans wrote:
> moin moin,
> 
> I'm giving a presentation on /etc/alternatives in a few hours.
> 
> If you use the alternatives system a lot and would like to spend a few
> minutes reviewing my talk for me, please see the links below.
> 
> Any use cases or cool functionality that I've missed?
> 
> Anything I've gotten completely wrong?
> 
> Any suggestions for good examples?
> 
> AsciiDoc source file:
> 
> https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.adoc
> 
> Slidy HTML ( one-page format without JavaScript, slides with JavaScript ):
> 
> https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.html
> 

You might add more info on how the other methods interact with
update-alternatives.  For example if I set the EDITOR env var how does
that interact with update-alternatives when I run visudo?  In fact I
think something like a "best practices" is needed for setting default
programs and then overriding them on a per user basis.  I'm not sure
this presentation is the right place for that but perhaps it could be
a wiki page in the future.



/etc/alternatives feedback for presentation

2018-08-09 Thread der.hans

moin moin,

I'm giving a presentation on /etc/alternatives in a few hours.

If you use the alternatives system a lot and would like to spend a few
minutes reviewing my talk for me, please see the links below.

Any use cases or cool functionality that I've missed?

Anything I've gotten completely wrong?

Any suggestions for good examples?

AsciiDoc source file:

https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.adoc

Slidy HTML ( one-page format without JavaScript, slides with JavaScript ):

https://www.LuftHans.com/Akten/Presentations/2018/PLUG/PLUG.intro_to_etc_alternatives.2018Aug09.html

ciao,

der.hans
--
#  https://www.LuftHans.com   https://www.PhxLinux.org
#  "The purpose of IT is to seamlessly and transparently provide the other
#  9/10's of the iceberg for people who need to work with chunks
#  of floating ice." -- Strata Rose Chalup