PATH is not affected by .pam_environment
Solution 1:
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.
Solution 2:
I have been running into this as well because I was trying to do it the way documentation said (I traditionally use Redhat based systems).
I think using ${PATH} only works if your path was originally set in the /etc/security/pam_env.conf file. It appears to me that the original path is set in /etc/login.defs, and then isn't available.
I dropped back to setting the values in ~/.profile, I have spent too much time debugging this seemingly simple thing. It makes me wonder what other Ubuntu users do, we can't be the first ones who wanted to append to the path variable. I'm guessing they have done the same, and ignored ~/.pam_environment.