Web lists-archives.com

Re: Setting default $PATH for all users




On 02/08/2019 07:37 AM, tomas@xxxxxxxxxx wrote:
On Fri, Feb 08, 2019 at 08:22:54AM -0500, Roberto C. Sánchez wrote:
On Fri, Feb 08, 2019 at 07:18:39AM -0600, Richard Owlett wrote:
I'm running Debian Stretch with MATE desktop.
I want the current user and all future users to include all directories in
root's $PATH.

I haven't found a definitive answer in my web search. The answer's seem to
depend on which Linux is used and multiple parameters.

As with most things in Linux and Unix, it depends.

Some likely candidates are /etc/bash.bashrc, /etc/profile,
/etc/profile.d/, and /etc/environment.

More background: processes inherit their environment from their
parent process, and so on.

[snip] there are "checkpoints" at which the (user) environment
can be set.

Traditionally that happens at login (/etc/profile,

Edited that to *NO* effect.

~/.profile

By my problem definition, any thing in /home/user is not relevant as I explicitly want something that affects all current and future users.


and all their shell-specific variations -- sometimes you want
slightly different environments for different shells).

But X. When X came up, a similar mechanism was introduced, to
let programs started directly from X also have nice environments:
That is where Xsession (of which there are system-wide scripts
in (Debian, at least) /etc/X11/Xsession, typically broken up
in task-specific snippets in /etc/X11/Xsession.d -- and user-specific
scripts in e.g. ~/.Xsession (or its older sibling ~/.Xsessionrc)).

See "man Xsession" and the scripts in /etc/X11/Xsession* -- they
are shell scripts and might inspire you.

No mention of path there.


With the advent of desktop environments things have become
a bit more complex, but I'm the wrong person for that: I just
fled the DE craze ten years ago.

Cheers
-- tomás