~/.profile vs ~/.pam_environment

Jonathan Marsden jmarsden at fastmail.fm
Fri Jun 14 04:48:48 UTC 2013


Lars,

On 06/13/2013 10:25 AM, Lars Nooden wrote:

> I read that the help document on environment variables [1] points to 
> ~/.pam_environment and /etc/environment as where to change variables.  
> 
> I notice that ~/.pam_environment is not present in Lubuntu (saucy) 
> and that changes to /etc/environment do not have effect, even when 
> removing ~/.profile
> 
> Are ~/.pam_environment and /etc/environment changes that are pending?

No.  /etc/environment has existed at least as far back as Hardy 8.04 :)

It should be parsed by the readenv pam module, used in /etc/pam.d/login
for example.  Everything seems to be in place for doing that in my
Lubuntu 13.04 VM here.  There is no difference that I know of between
Lubuntu and Ubuntu in this regard.

I just tested, by doing:

  echo 'TEST_ETC_ENVIRONMENT="This is a test"' |sudo tee -a
/etc/environment >/dev/null
  sudo shutdown -r now

  # After reboot
  echo $TEST_ETC_ENVIRONMENT

and it worked as expected and output

  This is a test

for me here.  This was tested in Lubuntu 13.04 Raring in an amd64
Virtualbox VM.

What specifically makes you think changes to /etc/environment "do not
have any effect" in Lubuntu Saucy?  Can you provide a complete set of
"steps to reproduce", please?  Make sure you log all the way out, or
reboot, after making a change to it.

Although I'm pretty confident /etc/environment works as it should in
Lubuntu, I'm much less sure about ~/.pam_environment, which I have not
used.  I suspect is a per-user optional override for the settings in
global /etc/environment -- if it is optional, then it will not be
present by default :)  Let's focus on whether /etc/environment works, first.

Jonathan




More information about the Lubuntu-users mailing list