Re: Default PATH setting - reduce to something more sensible?

Liste des GroupesRevenir à cu programmer 
Sujet : Re: Default PATH setting - reduce to something more sensible?
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.programmer
Date : 19. Jan 2025, 13:50:04
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vmisdt$27md1$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 16.01.2025 00:14, Scott Lurndal wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>
Essentially there were two questions I had that I can reformulate in a
more compact form as
>
 "Why, in the first place, are all these path components
  part of the default PATH for ordinary users? - Is there
  any [functional] rationale or necessity for that?"
 
Fundamentally, it's an implementation choice.  For example,
the Fedora root user  will have
 
   /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
 
as the PATH variable.

Yes, when sudo'ing commands these will also have a restricted
PATH (almost like that) in my Xubuntu environment. That's IMO
a good thing. (And I wished it were similar in the "ordinary
user"'s PATH.)

 
Novice users likely never change from the default path,
and one hopes (absent duplicate command names) that the
PATH variable places the most likely elements towards
the front of the list.
 
For korn shell, it will remember the element on a hit
and subsequent invocations of the command will get
a hit in the shell cache and will not search PATH.
 
If one has a custom command that clashes with one in the
distribution, one can simply include that directory in the
path before the rest (e.g. /usr/local/sbin above), but I
wouldn't expect to find that most general linux users
ever touch PATH.

In the 1990's we used to explicitly specify a well-defined short
PATH at the beginning of shell scripts - primarily for safety
considerations - but, frankly, I got sloppy over the decades in
my personal Unix environments.

[ NFS snipped ]
 
>
 "_If_ many of the default PATH components are unnecessary,
  where and how to best reduce these settings to a sensible
  subset? - Without spoiling the system, of course."
 
Iteratively remove elements.  If things don't work, put them back.

The shell configuration components don't seem to be responsible for
PATH entries like '/usr/lib/lightdm/lightdm', at least I haven't
found them in any global (less so in local) shell settings.

I should probably just ignore any default path setting and add my
own settings in my shell profiles and/or in my shell scripts.

Janis


Date Sujet#  Auteur
14 Jan 25 * Default PATH setting - reduce to something more sensible?17Janis Papanagnou
14 Jan 25 +- Re: Default PATH setting - reduce to something more sensible?1Dan Cross
14 Jan 25 `* Re: Default PATH setting - reduce to something more sensible?15Rainer Weikusat
14 Jan 25  +- Re: Default PATH setting - reduce to something more sensible?1Kaz Kylheku
14 Jan 25  `* Re: Default PATH setting - reduce to something more sensible?13Rainer Weikusat
15 Jan 25   +- Re: Default PATH setting - reduce to something more sensible?1Dan Cross
15 Jan 25   `* Re: Default PATH setting - reduce to something more sensible?11Rainer Weikusat
15 Jan 25    `* Re: Default PATH setting - reduce to something more sensible?10Rainer Weikusat
16 Jan 25     `* Re: Default PATH setting - reduce to something more sensible?9Janis Papanagnou
16 Jan 25      +- Re: Default PATH setting - reduce to something more sensible?1Dan Cross
16 Jan 25      +* Re: Default PATH setting - reduce to something more sensible?4Rainer Weikusat
19 Jan 25      i`* Re: Default PATH setting - reduce to something more sensible?3Janis Papanagnou
19 Jan 25      i `* Re: Default PATH setting - reduce to something more sensible?2Rainer Weikusat
20 Jan 25      i  `- Re: Default PATH setting - reduce to something more sensible?1Keith Thompson
16 Jan 25      +* Re: Default PATH setting - reduce to something more sensible?2Waldek Hebisch
16 Jan 25      i`- Re: Default PATH setting - reduce to something more sensible?1Rainer Weikusat
19 Jan 25      `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal