Ubuntu – PATH is not affected by .pam_environment

13.04environment-variablespam-environment

Running Ubuntu 13.04, I'm trying to add variables to PATH for the session, which is recommended to do inside .pam_environment, but nothing seems to work. Here's what it looks like:

JAVA_HOME          DEFAULT=/usr/lib/jvm/java-7-oracle
IDEA_HOME          DEFAULT=/usr/local/idea-IU-129.451/bin
LIGHTTABLE_HOME    DEFAULT=/usr/local/LightTable
CLOUDIFY_HOME      DEFAULT=/home/eliranm/builds/gigaspaces-cloudify
PATH               DEFAULT=${PATH}    OVERRIDE=${PATH}:${JAVA_HOME}:${IDEA_HOME}:${LIGHTTABLE_HOME}:${CLOUDIFY_HOME}

It seems all variables are set but the PATH, or that it is overridden somehow. I tried to prepend or append the ${PATH} variable, to use DEFAULT only, OVERRIDE only, tried to just set a hard-coded path as a value, all to no avail.

I'm following the recommendations from the Ubuntu help community, and I want to avoid concatenating hard-coded paths to the PATH inside /etc/environment as it's not the right scope, plus, it will be hard to maintain with no variables.

Others may be affected by this issue, as stated here, but no one provided a solution so far.

How to make this work?

Best Answer

I think that using $PATH variable inside the scope of /etc/environment or ~/.pam_environment does not get resolved, but assigned just as is literally.

In fact I see using $PATH or any variable inside ~/.pam_environment being discouraged on most post I read like here: Why doesn't my environment variable get set.

So I don't really know why here (Session-wide environment variables) they tell to use $PATH in it.

I know that Debian removed the parsing of the local ~/.pam_environment as it is a high security risk.

Anyway for my understanding the two files /etc/environment and ~/.pam_environment use a simpler syntax (simple KEY=VAL pairs for each line) then /etc/security/pam_env.conf (VARIABLE [DEFAULT=[value]] [OVERRIDE=[value]]). So perhaps no reference to variable can be made at all inside them.