0

I noticed that changing the content of /etc/environment in Ubuntu 16.04.1 immediately updates the output of env while doing this in Ubuntu 14.04.4 doesn't update the output of env (which requires you to reboot/login for the changes to take effect).

I couldn't find any information on this change when I searched the Internet. Does anyone know more about how this change was implemented? And, is there a way to let Ubuntu 14.04 behave like 16.04?

Update: The exact steps I take are:

sudo vim /etc/environment
*add or remove a line*
sudo env
*check whether the line is added or removed*
6
  • Can you summarize the exact steps you are taking to change the contents and to test the env output? I am unable to reproduce this behavior Jul 11, 2017 at 13:26
  • I've updated my question.
    – Sicco
    Jul 11, 2017 at 13:35
  • What you are describing only applies to the environment of processes run using sudo, I think - and is a result of differences in the /etc/pam.d/sudo configuration files. See sudo not setting environment variables in /etc/environment Jul 11, 2017 at 13:51
  • I checked the /etc/pam.d/sudo file on both systems, but their appears to be no difference. Any other suggestions?
    – Sicco
    Jul 11, 2017 at 14:08
  • Are you sure about that? Comparing 14.04 and 16.04 systems of my own, one has auth required pam_env.so readenv=1 while the other has session required pam_env.so readenv=1 (note auth versus session) Jul 11, 2017 at 14:11

1 Answer 1

0

Edit /etc/pam.d/sudo (e.g., sudo vim /etc/pam.d/sudo) and change auth to session at the start of the following line:

auth       required   pam_env.so readenv=1 user_readenv=0

So it should become:

session       required   pam_env.so readenv=1 user_readenv=0

You must log in to answer this question.

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