Set environment variable globally

Gunnar Hjalmarsson gunnarhj at ubuntu.com
Wed Apr 5 18:52:01 UTC 2017


On 2017-04-05 20:30, Andrew Martin wrote:
> From: "GĂ©rard BIGOT" <gerard.bigot at gmail.com>
>>
>> I added this line in /etc/environment since a long time :
>>
>> TZ="Europe/Paris"
>>
>> It gives me satisfaction.
>
> I can't seem to get this to work on 16.04. Which shell are you
> using? Have you customized your /etc/bash.bashrc or /etc/profile to
> source /etc/environment? I don't see any mention of /etc/environment
> in the bash manpage, so it seems like this file isn't being used.
> Also, how can I make this environment variable available to all
> processes started by upstart (14.04) and systemd (16.04)? I am
> concerned not only about interactive processes but also scripts (e.g.
> started via cron) and services (started via upstart or systemd).

/etc/environment is not a script file; it's read by PAM. But I don't 
think that happens early enough for services etc.

-- 
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj




More information about the Ubuntu-devel-discuss mailing list