Web lists-archives.com

Re: Setting default $PATH for all users




On Mon 11 Feb 2019 at 09:53:39 (+0100), tomas@xxxxxxxxxx wrote:
> On Sun, Feb 10, 2019 at 04:22:44PM -0600, Richard Owlett wrote:
> > On 02/10/2019 03:42 PM, tomas@xxxxxxxxxx wrote:
> > >On Sun, Feb 10, 2019 at 02:57:22PM -0600, Richard Owlett wrote:
> > >
> > >[...]
> > >
> > >>Unless someone can point to a single location to modify that:
> > >>   1. modify existing user(s)
> > >>   2. have effect for ALL future users
> > >>   3. survive updating to future releases
> > >>I'll drop the issue.
> > >>Thanks all.
> > >
> > >Did you ever give consideration to the stuff in /etc/X11/xsession.d?
> > 
> > Yes.
> > Also looked at other X11 links suggested by drilling down thru links
> > to links ...
> > 
> > Having just been taught the value of "grep" I just did
> > "grep -r path /etc/X11" and "grep -r PATH /etc/X11" to see if I had
> > missed anything. Hadn't.
> 
> It's not (necessarily) about a PATH being there. Rather about you
> putting one there, usually in the form:
> 
>   PATH="/my/preferred/path:$PATH
> 
> (substitute as appropriate). Or append your preferred paths if you
> want the usual suspects (/bin, /usr/bin, etc.) to take precedence.
> Or both.

Well, I had expected that there might be some defaults set somewhere
in a text file (or as comments) …

> > >What's in that directory (on your machine)?
> > 
> > >root@fromdell:/home/richard# ls /etc/X11/Xsession.d
> > >20dbus_xdg-runtime	   50x11-common_determine-startup  90gpg-agent
> > >20vdpau-va-gl		   55mate-session_materc	   90qt-a11y
> > >20x11-common_process-args  60xbrlapi			   90x11-common_ssh-agent
> > >30x11-common_xresources    60xdg-user-dirs-update	   95dbus_update-activation-env
> > >35x11-common_xhost-local   75dbus_dbus-launch		   99mate-environment
> > >40x11-common_xsessionrc    90atk-adaptor		   99x11-common_start
> 
> Looks pretty standard. Now do try putting a new file into Xsession.d
> containing a line as suggested above and named, e.g. "97richards-path"
> or something similar (92 means it happens near the end, the rest
> is just for you to remember the perpetrator). Decorate it with some
> comments. Remember, it's shell text which is "sourced" (i.e. included
> as part, not executed in a subshell) by some bigger thing.
> 
> > >root@fromdell:/home/richard#
> > 
> > [https://launchpadlibrarian.net/94971962/01_set-default-path.patch]
> > and [https://lists.debian.org/debian-user/2014/04/msg00006.html]
> > indicate that at one time the behavior was hard coded into lightdm.
> 
> I'll believe that when I see it. I don't think they bypass the X11
> session mechanism.

… but perhaps not. I notice that the patch is for else clauses,
which could indicate fallback PATHs when nothing else is found.

And these patches do look like they're in the code:

 $ strings /tmp/lightdm/usr/sbin/lightdm | grep /bin:
 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
 $ 

Cheers,
David.