5

I have a set of environment variables that I need to be globally set for all users and all systemd services. I don't want to have to specify them it two different locations.

I tried setting them /etc/environment and /etc/profile.d. These both worked, but only for logged in users, not systemd services.

I tried setting them /etc/default/init and that didn't work for any process.

How can I set environment variables globally for all users and all services without having to specify them redundantly in multiple locations?

Distribution: Raspbian

1
  • 1
    Systemd intentionally runs services in a clean environment.
    – jordanm
    Mar 20, 2017 at 1:28

1 Answer 1

0

DefaultEnvironment directive in system.conf does this for systemd.

https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html#DefaultEnvironment=

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .