Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #205126 > unrolled thread

Setting default $PATH for all users

Started byRichard Owlett <rowlett@cloud85.net>
First post2019-02-08 14:20 +0100
Last post2019-02-11 03:30 +0100
Articles 9 on this page of 29 — 10 participants

Back to article view | Back to linux.debian.user


Contents

  Setting default $PATH for all users Richard Owlett <rowlett@cloud85.net> - 2019-02-08 14:20 +0100
    Re: Setting default $PATH for all users Roberto C. Sánchez <roberto@debian.org> - 2019-02-08 14:30 +0100
      Re: Setting default $PATH for all users <tomas@tuxteam.de> - 2019-02-08 14:40 +0100
        Re: Setting default $PATH for all users Richard Owlett <rowlett@cloud85.net> - 2019-02-08 16:00 +0100
          Re: Setting default $PATH for all users Dan Ritter <dsr@randomstring.org> - 2019-02-08 16:10 +0100
            Re: Setting default $PATH for all users David Wright <deblis@lionunicorn.co.uk> - 2019-02-11 04:10 +0100
              Re: Setting default $PATH for all users <tomas@tuxteam.de> - 2019-02-11 10:00 +0100
                Re: Setting default $PATH for all users rhkramer@gmail.com - 2019-02-11 13:50 +0100
                  Re: Setting default $PATH for all users Curt <curty@free.fr> - 2019-02-11 14:10 +0100
                    Re: Setting default $PATH for all users rhkramer@gmail.com - 2019-02-11 18:10 +0100
                      Re: Setting default $PATH for all users Curt <curty@free.fr> - 2019-02-11 18:30 +0100
                        Re: Setting default $PATH for all users Greg Wooledge <wooledg@eeg.ccf.org> - 2019-02-11 18:40 +0100
                          Re: Setting default $PATH for all users Curt <curty@free.fr> - 2019-02-11 18:50 +0100
                            Re: Setting default $PATH for all users David Wright <deblis@lionunicorn.co.uk> - 2019-02-11 21:00 +0100
          Re: Setting default $PATH for all users <tomas@tuxteam.de> - 2019-02-08 16:40 +0100
    Re: Setting default $PATH for all users David Wright <deblis@lionunicorn.co.uk> - 2019-02-08 20:10 +0100
      Re: Setting default $PATH for all users Richard Owlett <rowlett@cloud85.net> - 2019-02-10 22:00 +0100
        Re: Setting default $PATH for all users Andy Smith <andy@strugglers.net> - 2019-02-10 22:30 +0100
          Re: Setting default $PATH for all users Richard Owlett <rowlett@cloud85.net> - 2019-02-10 22:50 +0100
            Re: Setting default $PATH for all users Andy Smith <andy@strugglers.net> - 2019-02-11 00:30 +0100
          Re: Setting default $PATH for all users Lee <ler762@gmail.com> - 2019-02-11 00:10 +0100
            Re: Setting default $PATH for all users Richard Owlett <rowlett@cloud85.net> - 2019-02-11 00:30 +0100
              Re: Setting default $PATH for all users Lee <ler762@gmail.com> - 2019-02-11 01:30 +0100
                Re: Setting default $PATH for all users Greg Wooledge <wooledg@eeg.ccf.org> - 2019-02-11 15:40 +0100
        Re: Setting default $PATH for all users <tomas@tuxteam.de> - 2019-02-10 22:50 +0100
          Re: Setting default $PATH for all users Richard Owlett <rowlett@cloud85.net> - 2019-02-10 23:30 +0100
            Re: Setting default $PATH for all users <tomas@tuxteam.de> - 2019-02-11 10:00 +0100
              Re: Setting default $PATH for all users David Wright <deblis@lionunicorn.co.uk> - 2019-02-11 14:50 +0100
        Re: Setting default $PATH for all users David Wright <deblis@lionunicorn.co.uk> - 2019-02-11 03:30 +0100

Page 2 of 2 — ← Prev page 1 [2]


#205179

FromLee <ler762@gmail.com>
Date2019-02-11 00:10 +0100
Message-ID<xq6ox-7pb-1@gated-at.bofh.it>
In reply to#205175
On 2/10/19, Andy Smith <andy@strugglers.net> wrote:
> Hello,
>
> On Sun, Feb 10, 2019 at 02:57:22PM -0600, Richard Owlett wrote:
>> I used "grep -r /usr/local/games /etc" which yielded "/etc/login.defs"
>> and
>> "/etc/profile". Editing those two files had no effect.
>
> How are you determining that changes to /etc/profile had no effect?
> Because changes there (or in files in /etc/profile.d/) should affect all
> new shels that you launch. Example:
>
> $ cat /etc/profile.d/extrapath.sh
> export PATH=$PATH:/foo
>
> Then I open a new shell and echo $PATH, /foo is in there.
>
> If that is not your experience, you are doing something wrong, or your
> system is very broken.

Or you're using xfce which seems to ignore .profile & .bash_profile
Creating an /etc/profile.d/extrapath.sh from your example didn't do
anything for me.

adding the line
export PATH=$PATH:/foo
to /etc/bash.bashrc however...

followup question - why are the bash "login" dot files ignored if
you're using xfce?

Regards,
Lee

[toc] | [prev] | [next] | [standalone]


#205180

FromRichard Owlett <rowlett@cloud85.net>
Date2019-02-11 00:30 +0100
Message-ID<xq6HT-7xf-9@gated-at.bofh.it>
In reply to#205179
On 02/10/2019 05:00 PM, Lee wrote:
> On 2/10/19, Andy Smith <andy@strugglers.net> wrote:
>> Hello,
>>
>> On Sun, Feb 10, 2019 at 02:57:22PM -0600, Richard Owlett wrote:
>>> I used "grep -r /usr/local/games /etc" which yielded "/etc/login.defs"
>>> and
>>> "/etc/profile". Editing those two files had no effect.
>>
>> How are you determining that changes to /etc/profile had no effect?
>> Because changes there (or in files in /etc/profile.d/) should affect all
>> new shels that you launch. Example:
>>
>> $ cat /etc/profile.d/extrapath.sh
>> export PATH=$PATH:/foo
>>
>> Then I open a new shell and echo $PATH, /foo is in there.
>>
>> If that is not your experience, you are doing something wrong, or your
>> system is very broken.
> 
> Or you're using xfce which seems to ignore .profile & .bash_profile
> Creating an /etc/profile.d/extrapath.sh from your example didn't do
> anything for me.
> 
> adding the line
> export PATH=$PATH:/foo
> to /etc/bash.bashrc however...
> 
> followup question - why are the bash "login" dot files ignored if
> you're using xfce?

Perhaps 'cause I've never used xfce?
For the record I'm using MATE as DE and lightdm as DM.

> 
> Regards,
> Lee
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#205183

FromLee <ler762@gmail.com>
Date2019-02-11 01:30 +0100
Message-ID<xq7DX-8fo-1@gated-at.bofh.it>
In reply to#205180
On 2/10/19, Richard Owlett <rowlett@cloud85.net> wrote:
> On 02/10/2019 05:00 PM, Lee wrote:
>> On 2/10/19, Andy Smith <andy@strugglers.net> wrote:
>>> Hello,
>>>
>>> On Sun, Feb 10, 2019 at 02:57:22PM -0600, Richard Owlett wrote:
>>>> I used "grep -r /usr/local/games /etc" which yielded "/etc/login.defs"
>>>> and
>>>> "/etc/profile". Editing those two files had no effect.
>>>
>>> How are you determining that changes to /etc/profile had no effect?
>>> Because changes there (or in files in /etc/profile.d/) should affect all
>>> new shels that you launch. Example:
>>>
>>> $ cat /etc/profile.d/extrapath.sh
>>> export PATH=$PATH:/foo
>>>
>>> Then I open a new shell and echo $PATH, /foo is in there.
>>>
>>> If that is not your experience, you are doing something wrong, or your
>>> system is very broken.
>>
>> Or you're using xfce which seems to ignore .profile & .bash_profile
>> Creating an /etc/profile.d/extrapath.sh from your example didn't do
>> anything for me.
>>
>> adding the line
>> export PATH=$PATH:/foo
>> to /etc/bash.bashrc however...
>>
>> followup question - why are the bash "login" dot files ignored if
>> you're using xfce?
>
> Perhaps 'cause I've never used xfce?
> For the record I'm using MATE as DE and lightdm as DM.

Which is semi-interesting I guess, but you're the one that wanted a
single location to add $PATH elements for all current & future users -
yes?  The interesting answer would be if adding
export PATH=$PATH:/foo
to /etc/bash.bashrc is what you're looking for.

Regards,
Lee

[toc] | [prev] | [next] | [standalone]


#205200

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2019-02-11 15:40 +0100
Message-ID<xqkUx-8tp-5@gated-at.bofh.it>
In reply to#205183
On Sun, Feb 10, 2019 at 07:28:02PM -0500, Lee wrote:
> Which is semi-interesting I guess, but you're the one that wanted a
> single location to add $PATH elements for all current & future users -
> yes?  The interesting answer would be if adding
> export PATH=$PATH:/foo
> to /etc/bash.bashrc is what you're looking for.

This only adds the PATH component to interactive bash shells.  It does
not, for example, add it to window managers, desktop environments, web
browsers launched from window manager menus, etc.  Nor does it affect
users of other shells than bash.

<https://mywiki.wooledge.org/DotFiles> gives a decent overview of
how some logins work, including a tiny bit of Debian-specific stuff.
It's missing some pieces (e.g. Debian's ~/.xsessionrc, Arch Linux's
~/.xprofile, warnings about GNOME/dbus), but it's a good start.

See <https://wiki.debian.org/Xsession> for a bit more info on the
Debian-specific stuff, including the ~/.xsessionrc file.

<https://wiki.debian.org/DotFiles> is based on an older version of that
page and may also be helpful.  I wrote the original page on tarzeau's
forerunner of the Debian wiki, and he migrated it to the current wiki
in 2007.  Looks like there have been just a few edits since then, so
the bulk of the page is still my original writing from 15 years ago.
Comparing to the current version on wooledge.org will show you how my
writing has improved since then.  It's still a lifelong learning process.

[toc] | [prev] | [next] | [standalone]


#205176

From<tomas@tuxteam.de>
Date2019-02-10 22:50 +0100
Message-ID<xq597-6s8-1@gated-at.bofh.it>
In reply to#205173

[Multipart message — attachments visible in raw view] — view raw

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?

What's in that directory (on your machine)?

Cheers
-- t

[toc] | [prev] | [next] | [standalone]


#205178

FromRichard Owlett <rowlett@cloud85.net>
Date2019-02-10 23:30 +0100
Message-ID<xq5LP-6VQ-1@gated-at.bofh.it>
In reply to#205176
On 02/10/2019 03:42 PM, tomas@tuxteam.de 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.

> 
> 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
> 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.


> 
> Cheers
> -- t
> 

[toc] | [prev] | [next] | [standalone]


#205191

From<tomas@tuxteam.de>
Date2019-02-11 10:00 +0100
Message-ID<xqfBv-4R0-1@gated-at.bofh.it>
In reply to#205178

[Multipart message — attachments visible in raw view] — view raw

On Sun, Feb 10, 2019 at 04:22:44PM -0600, Richard Owlett wrote:
> On 02/10/2019 03:42 PM, tomas@tuxteam.de 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.

> >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.

Cheers
-- tomás

[toc] | [prev] | [next] | [standalone]


#205198

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-02-11 14:50 +0100
Message-ID<xqk8a-7XA-5@gated-at.bofh.it>
In reply to#205191
On Mon 11 Feb 2019 at 09:53:39 (+0100), tomas@tuxteam.de wrote:
> On Sun, Feb 10, 2019 at 04:22:44PM -0600, Richard Owlett wrote:
> > On 02/10/2019 03:42 PM, tomas@tuxteam.de 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.

[toc] | [prev] | [next] | [standalone]


#205184

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-02-11 03:30 +0100
Message-ID<xq9w5-Zn-1@gated-at.bofh.it>
In reply to#205173
On Sun 10 Feb 2019 at 14:57:22 (-0600), Richard Owlett wrote:
> On 02/08/2019 12:55 PM, David Wright wrote:
> > On Fri 08 Feb 2019 at 07:18:39 (-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.
> > 
> > If you're talking about PATH, then you're talking about logging in.
> > So of equal importance to the DE you're using is the DM, and I'll
> > guess that's likely lightdm. Was that amongst your search terms? >
> > > I haven't found a definitive answer in my web search. The answers
> > > seem to depend on which Linux is used and multiple parameters.
> > 
> > Yes, as are so many other details of configuration.
> > 
> > If searching outwards gets you no further, then perhaps turn your
> > attention inwards. For example,   grep -r PATH /etc   or, a little
> > less noisy,   grep -r PATH= /etc   will reveal some candidates
> > (plus lots of false positives, which the filenames will make obvious).
> 
> I used "grep -r /usr/local/games /etc" which yielded "/etc/login.defs"
> and "/etc/profile".

You've lost me. I don't see much similarity between:

    grep -r PATH= /etc

and

    grep -r /usr/local/games /etc

> Editing those two files had no effect.

There's little point in posting a sentence like that. You don't show
what edits you did, nor what tests you performed.

> I did a new search including "lightdm" as one term.

I assume that's confirmation that you do use a DM.
In which case many people here may have difficulty helping you
directly as they're going to be like me: not using one.

So I can only make suggestions as to where to look. I don't know
what you'll find where, and whether it'll help. I've read that
DMs and DEs can be difficult to bend to your will.

> I got multiple hits - [none seemed authoritative].

I've no idea what that means. There are plenty of lightdm docs/wikis
out there. Do you expect some sort of .gov website?

> I did get one hit which hints I may not get what I want.

Do you mean that someone posted that they gave up trying? …

> A thread discussing a quite different situation says in part:
> > The basic problem is that lightdm in Debian hard-codes the path
> > https://launchpadlibrarian.net/94971962/01_set-default-path.patch
> 	[https://lists.debian.org/debian-user/2014/04/msg00006.html]
> Although the link is to a Ubuntu bug report, not Debian, the code
> shown is consistent with my observations.

… or is that your one hit?

> 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.

I don't think there is just one location to set an environment
variable for every access method and in every circumstance.
So it might help to know what you really want to do. After all,
every PATH= line has a specific purpose. What's yours?

Cheers,
David.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.debian.user


csiph-web