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

Liste des GroupesRevenir à cu shell 
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.shell
Suivi-à : comp.unix.shell
Date : 14. Jan 2025, 14:55:19
Autres entêtes
Organisation : PANIX Public Access Internet and UNIX, NYC
Message-ID : <vm5qc7$ft9$1@reader2.panix.com>
References : 1
User-Agent : trn 4.0-test77 (Sep 1, 2010)
[Meta note: This is more of a comp.unix.shell sort of post; not
so much comp.unix.programmer.  Followup-To: set accordingly.]

In article <vm5dei$2c7to$1@dont-email.me>,
Janis Papanagnou  <janis_papanagnou+ng@hotmail.com> wrote:
When I recently inspected an 'strace' log and saw the huge amount
of system-calls done for a simple standard command (like 'rm') -
it's more than a dozen! and most lead just to ENOENT - I wondered
about the default PATH definition which is for my system
 /usr/lib/lightdm/lightdm
 /usr/local/sbin
 /usr/local/bin
 /usr/sbin
 /usr/bin
 /sbin
 /bin
 /usr/games
(here I'm omitting my own additions, '~/bin' and '.', and I separated
them, one on each line for a better visualization of the "problem" or,
maybe better, for the "questions".)

On a single-user system, it's not a huge deal, but on a
multiuser system where you may `cd` into a directory writable by
anyone (such as /tmp), `.` in $PATH is a known security problem.
YMMV, but caveat emptor.

The above PATH components are for a terminal running under some
window manager, a plain console window will not show the 'lightdm'
entry (but I rarely work on plain consoles).
>
This raises a few questions, and someone may shed some light on the
rationale for above default settings... (and how to "fix" it best)
>
Why do I need 'lightdm/lightdm' in the user's PATH variable defined?
(That directory contains just one special script and one executable.)
This entry is what annoys me most; it also reminds me of systems that
have every program vendor add an own PATH entry for their products.
Would it be safe to just remove that (in my '~/.profile') from PATH?
Or can I make it vanish by some other change, to not appear in the
in the PATH first place? (Of course without destabilizing the system
by that.)

If you don't feel like you need to run that executable, and the
window manager works ok without it, I don't see why it would be
a problem to remove it from $PATH.

There's no files in '/usr/local/sbin' (on my system); no admins with
special tools desires.
>
I don't seem to use executables from all the 'sbin' directories; I'm
positive I need /usr/bin, /bin, and I've also installed some things
in /usr/local/bin. It seems to me that, as a normal user, the PATH
(and with it the path-search) could be drastically reduced. Is there
a method to only have them in the PATH when 'sudo'ing any programs
that require root privileges and the privileged programs in 'sbin'?

Yes, `sudo` can be configured to set $PATH for the programs that
it invokes; see sudoers(5) and look for `secure_path`.  If you
don't invoke those from your normal shell, I don't see a problem
removing them from the default.

I mean, if I 'sodo' a shell I get - and I think this is sensible! -
only /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
(no 'lightdm', no 'games', and no personal settings) anyway, and I
seem to have those entries available independent of any parent
process's setting;  PATH=/usr/bin sudo ksh  will still provide all
the 'sbin' directories in the privileged shell's own PATH setting.
>
So my thought is, for the moment as a workaround, to edit the PATH
in the .profile, and _remove_ all 'sbin' and the 'lightdm' entries,
or just explicitly _define_ PATH without the spurious parts). (Or
would it be advisable to do that change in all the shells' .rc
files?) Or is there yet a better place to "fix" things system-wide?
>
(Or better not touch a running system? - but it looks so messy!)

Personally, I'd let well enough alone, but I suppose this
alludes to a larger question: does having those entries in $PATH
affect the operation of the system in any materially negative
way?  Is this just a preference for tidiness kind of thing?

There's no harm in cleaning up, but I suspect any marginal
resource savings has already been offset by thinking about it
at all.  :-)

What is the desired end-state here?

- Dan C.


Date Sujet#  Auteur
14 Jan 25 * Re: Default PATH setting - reduce to something more sensible?84Dan Cross
14 Jan 25 +- Re: Default PATH setting - reduce to something more sensible?1Richard Harnden
20 Jan 25 `* Re: Default PATH setting - reduce to something more sensible?82Wayne
20 Jan 25  `* Re: Default PATH setting - reduce to something more sensible?81Janis Papanagnou
21 Jan 25   `* Re: Default PATH setting - reduce to something more sensible?80Axel Reichert
21 Jan 25    +* Re: Default PATH setting - reduce to something more sensible?7Janis Papanagnou
22 Jan 25    i+* Soft-links to binaries (was Re: Default PATH setting)4Janis Papanagnou
22 Jan 25    ii`* Re: Soft-links to binaries (was Re: Default PATH setting)3Keith Thompson
22 Jan 25    ii +- Re: Soft-links to binaries (was Re: Default PATH setting)1Lawrence D'Oliveiro
23 Jan 25    ii `- Re: Soft-links to binaries (was Re: Default PATH setting)1Janis Papanagnou
25 Jan 25    i`* PATH for GUI applications (was: Default PATH setting - reduce to something more sensible?)2Axel Reichert
26 Jan 25    i `- Re: PATH for GUI applications (was: Default PATH setting - reduce to something more sensible?)1Lawrence D'Oliveiro
22 Jan 25    `* Re: Default PATH setting - reduce to something more sensible?72Geoff Clare
22 Jan 25     `* Re: Default PATH setting - reduce to something more sensible?71Kaz Kylheku
23 Jan 25      `* Re: Default PATH setting - reduce to something more sensible?70Geoff Clare
23 Jan 25       `* Re: Default PATH setting - reduce to something more sensible?69Kenny McCormack
23 Jan 25        +* Re: Default PATH setting - reduce to something more sensible?52Dan Cross
23 Jan 25        i`* Re: Default PATH setting - reduce to something more sensible?51Janis Papanagnou
23 Jan 25        i +* Re: Default PATH setting - reduce to something more sensible?3Keith Thompson
24 Jan 25        i i`* Re: Default PATH setting - reduce to something more sensible?2Janis Papanagnou
24 Jan 25        i i `- Re: Default PATH setting - reduce to something more sensible?1Keith Thompson
23 Jan 25        i +* Re: Default PATH setting - reduce to something more sensible?3Kaz Kylheku
24 Jan 25        i i+- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
24 Jan 25        i i`- Re: Default PATH setting - reduce to something more sensible?1Jerry Peters
23 Jan 25        i +- Re: Default PATH setting - reduce to something more sensible?1marrgol
24 Jan 25        i `* Re: Default PATH setting - reduce to something more sensible?43Dan Cross
24 Jan 25        i  `* Re: Default PATH setting - reduce to something more sensible?42Janis Papanagnou
24 Jan 25        i   +* Re: Default PATH setting - reduce to something more sensible?14Dan Cross
25 Jan 25        i   i+* Re: Default PATH setting - reduce to something more sensible?5Janis Papanagnou
25 Jan 25        i   ii`* Re: Default PATH setting - reduce to something more sensible?4Dan Cross
26 Jan 25        i   ii +* Re: Default PATH setting - reduce to something more sensible?2Keith Thompson
27 Jan 25        i   ii i`- Re: Default PATH setting - reduce to something more sensible?1Dan Cross
26 Jan 25        i   ii `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
26 Jan 25        i   i`* Re: Default PATH setting - reduce to something more sensible?8Keith Thompson
26 Jan 25        i   i +* Re: Default PATH setting - reduce to something more sensible?3Janis Papanagnou
26 Jan 25        i   i i`* Re: Default PATH setting - reduce to something more sensible?2Christian Weisgerber
27 Jan 25        i   i i `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
26 Jan 25        i   i `* Early history of Bash (was: Re: Default PATH setting - reduce to something more sensible?)4Christian Weisgerber
27 Jan 25        i   i  +- Re: Early history of Bash1Keith Thompson
27 Jan 25        i   i  `* Re: Early history of Bash2Keith Thompson
27 Jan 25        i   i   `- Re: Early history of Bash1Lawrence D'Oliveiro
24 Jan 25        i   `* Re: Default PATH setting - reduce to something more sensible?27Keith Thompson
25 Jan 25        i    `* Re: Default PATH setting - reduce to something more sensible?26Janis Papanagnou
26 Jan 25        i     `* Re: Default PATH setting - reduce to something more sensible?25Keith Thompson
26 Jan 25        i      +* Re: Default PATH setting - reduce to something more sensible?23Kaz Kylheku
26 Jan 25        i      i`* Re: Default PATH setting - reduce to something more sensible?22Janis Papanagnou
26 Jan 25        i      i +* Re: Default PATH setting - reduce to something more sensible?2Kaz Kylheku
27 Jan 25        i      i i`- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
26 Jan 25        i      i +* Re: Default PATH setting - reduce to something more sensible?3Keith Thompson
3 Feb 25        i      i i`* Re: Default PATH setting - reduce to something more sensible?2Keith Thompson
3 Feb 25        i      i i `- Re: Default PATH setting - reduce to something more sensible?1Kaz Kylheku
27 Jan 25        i      i `* Re: Default PATH setting - reduce to something more sensible?16Lawrence D'Oliveiro
27 Jan 25        i      i  +- Re: Default PATH setting - reduce to something more sensible?1Kenny McCormack
27 Jan 25        i      i  +* Re: Default PATH setting - reduce to something more sensible?11Alexis
27 Jan 25        i      i  i+* Re: Default PATH setting - reduce to something more sensible?2Kenny McCormack
27 Jan 25        i      i  ii`- Re: Default PATH setting - reduce to something more sensible?1Alexis
27 Jan 25        i      i  i`* Re: Default PATH setting - reduce to something more sensible?8Lawrence D'Oliveiro
27 Jan 25        i      i  i `* Re: Default PATH setting - reduce to something more sensible?7Keith Thompson
27 Jan 25        i      i  i  +* Re: Default PATH setting - reduce to something more sensible?3Kaz Kylheku
27 Jan 25        i      i  i  i`* Arbitrary characters in filenames (was Re: Default PATH setting ...)2Janis Papanagnou
27 Jan 25        i      i  i  i `- Re: Arbitrary characters in filenames (was Re: Default PATH setting ...)1Kaz Kylheku
28 Jan 25        i      i  i  `* Re: Default PATH setting - reduce to something more sensible?3Lawrence D'Oliveiro
28 Jan 25        i      i  i   +- Re: Default PATH setting - reduce to something more sensible?1Keith Thompson
28 Jan 25        i      i  i   `- Re: Default PATH setting - reduce to something more sensible?1Kenny McCormack
27 Jan 25        i      i  +* Re: Default PATH setting - reduce to something more sensible?2Janis Papanagnou
28 Jan 25        i      i  i`- Re: Default PATH setting - reduce to something more sensible?1Lawrence D'Oliveiro
27 Jan 25        i      i  `- Re: Default PATH setting - reduce to something more sensible?1Kaz Kylheku
26 Jan 25        i      `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
23 Jan 25        +* Re: Default PATH setting - reduce to something more sensible?14Kaz Kylheku
23 Jan 25        i`* Re: Default PATH setting - reduce to something more sensible?13Keith Thompson
24 Jan 25        i +* Re: Default PATH setting - reduce to something more sensible?5Keith Thompson
24 Jan 25        i i`* Re: Default PATH setting - reduce to something more sensible?4Kaz Kylheku
24 Jan 25        i i `* Re: Default PATH setting - reduce to something more sensible?3Keith Thompson
24 Jan 25        i i  `* Re: Default PATH setting - reduce to something more sensible?2Lawrence D'Oliveiro
24 Jan 25        i i   `- Re: Default PATH setting - reduce to something more sensible?1Keith Thompson
24 Jan 25        i `* Re: Default PATH setting - reduce to something more sensible?7Janis Papanagnou
24 Jan 25        i  `* Re: Default PATH setting - reduce to something more sensible?6Dan Cross
24 Jan 25        i   `* Re: Default PATH setting - reduce to something more sensible?5Janis Papanagnou
24 Jan 25        i    +* Re: Default PATH setting - reduce to something more sensible?2Dan Cross
25 Jan 25        i    i`- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
24 Jan 25        i    `* Re: Default PATH setting - reduce to something more sensible?2Keith Thompson
25 Jan 25        i     `- Re: Default PATH setting - reduce to something more sensible?1Janis Papanagnou
24 Jan 25        `* Re: Default PATH setting - reduce to something more sensible?2Geoff Clare
24 Jan 25         `- Re: Default PATH setting - reduce to something more sensible?1Kenny McCormack

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal