Deutsch English Français Italiano |
<vm5dei$2c7to$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!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: Default PATH setting - reduce to something more sensible? Date: Tue, 14 Jan 2025 11:14:40 +0100 Organization: A noiseless patient Spider Lines: 58 Message-ID: <vm5dei$2c7to$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 14 Jan 2025 11:14:42 +0100 (CET) Injection-Info: dont-email.me; posting-host="3244c3cf7af00d5f2b161a466407d110"; logging-data="2498488"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1d4cBlILqTxr0ZgMYHdCy" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:dWGjV7odxuIvttX8gNwbsjO/gLI= X-Enigmail-Draft-Status: N1110 X-Mozilla-News-Host: news://news.eternal-september.org:119 Bytes: 3826 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".) 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.) 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'? 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!) Janis