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 – steeldriver Jul 11 '17 at 13:26
  • I've updated my question. – Sicco Jul 11 '17 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 – steeldriver Jul 11 '17 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 '17 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) – steeldriver Jul 11 '17 at 14:11
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.