Where to put the assignment of global environment variables

Volker Wysk post at volker-wysk.de
Tue Sep 13 10:53:33 UTC 2022


Am Dienstag, dem 13.09.2022 um 11:24 +0200 schrieb Oliver Grawert:
> hi,
> Am Dienstag, dem 13.09.2022 um 07:37 +0200 schrieb Volker Wysk:
> > Hi!
> > 
> > I want to do it right. I have global variables (PATH, MANPATH,
> > INFOPATH),
> > which need to be extended. I've tried it in /etc/environment, but
> > that
> > didn't have any effect. On the web, I've found the advice to put it
> > in a
> > script in /etc/profile.d, but there it gets evaluated *multiple*
> > times.
> > 
> > Is that normal? Or where's the intended place for those environment
> > variables?
> 
> while you would normally put them into /etc/environment, in recent
> releases there is now /etc/environment.d where you can put your
> variable snippets that systemd will read alongside /etc/environment on
> boot. 

As I've written, it had no effect putting it in /etc/environment. I've put
it in /etc/profile.d/ now, and meanwhile it works. I don't know if it would
work in /etc/environment.d/ now.

> so you do not need to edit the file itself but can just drop your 
> extras into the dir ...

That's clearly preferable.

Regards,
Volker




More information about the ubuntu-users mailing list