Sujet : Re: Default PATH setting - reduce to something more sensible?
De : cross (at) *nospam* spitfire.i.gajendra.net (Dan Cross)
Groupes : comp.unix.programmer comp.unix.shellSuivi-à : comp.unix.shellDate : 16. Jan 2025, 00:26:51
Autres entêtes
Organisation : PANIX Public Access Internet and UNIX, NYC
Message-ID : <vm9g7r$ish$1@reader2.panix.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
vm9err$35gfs$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> wrote:
[snip]
Since you're referring to me, the OP, please note that most arguments
here have quickly made a relation to a straw man (a performance theme)
or made other deviations from the basic question(s) that concerned me.
>
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?"
Not particularly.
The system has, probably for no really principled reason,
evolved over time such that that's simply the set of things that
are in $PATH by default on that particular machine. Another
machine might be different.
If I had to hazard a guess, I imagine some of it comes from the
folks who put together the distribution, some upgrades, and the
choices of e.g. the window manager you're using (recalling that
at least one $PATH component appeared to come from that).
"_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."
There are many ways you could do this. Probably the easiest is
just to explicitly set $PATH in your shell's startup files to
those directories you care about; that's what I usually do. If
you make a mistake with it, you won't affect the rest of the
system.
If you want to set it globally for all users, there's likely
some file in /etc or similar that sets the defaults; on my Linux
machine I see a number of things in /etc/profile and
/etc/profile.d/* that seem relevant and there's /etc/login.defs;
PAM has its own way to set up $PATH. I'm not sure I'd bother,
though, if setting it up for your own account is sufficient.
- Dan C.