| Deutsch English Français Italiano |
|
<vmisdt$27md1$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.unix.programmer Subject: Re: Default PATH setting - reduce to something more sensible? Date: Sun, 19 Jan 2025 13:50:04 +0100 Organization: A noiseless patient Spider Lines: 61 Message-ID: <vmisdt$27md1$1@dont-email.me> References: <vm5dei$2c7to$1@dont-email.me> <87ikqh5n9u.fsf@doppelsaurus.mobileactivedefense.com> <53xhP.976$GtJ8.93@fx48.iad> <87ed155hdu.fsf@doppelsaurus.mobileactivedefense.com> <poBhP.1243903$bYV2.919023@fx17.iad> <877c6wf5o2.fsf@doppelsaurus.mobileactivedefense.com> <rRQhP.65293$XfF8.23235@fx04.iad> <8734hjga0n.fsf@doppelsaurus.mobileactivedefense.com> <vm9err$35gfs$1@dont-email.me> <BjXhP.796221$DYF8.575618@fx14.iad> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Sun, 19 Jan 2025 13:50:05 +0100 (CET) Injection-Info: dont-email.me; posting-host="e25c2d96020b61c46ab4932d82a1a471"; logging-data="2349473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/9uPaVj4Ir9l0Az8lu5PHK" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:8gDeTFE8KDixfqHWP63kdA5bcL4= In-Reply-To: <BjXhP.796221$DYF8.575618@fx14.iad> X-Enigmail-Draft-Status: N1110 Bytes: 3790 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