6

I have this line in my ~/.pam_environment:

PATH             DEFAULT=${HOME}/bin:${HOME}/.local/bin:${PATH}

and it worked perfectly well on Ubuntu 12.10, but since I've updated to 13.04 it is completely ignored:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Any ideas why?

Radu Rădeanu
  • 166,822
  • 48
  • 327
  • 400
szx
  • 548
  • 1
  • 6
  • 16

1 Answers1

0

~/.pam_environment does not use the normal syntax and you should strictly follow the pam_env.conf syntax.

Note: Using .pam_environment requires a re-login in order to initialize the variables. Restarting just the terminal is not sufficient to be able to use the variables.

Source: Session-wide environment variables.

But I think that the right place to define environment variables such as PATH is ~/.profile or ~/bashrc file (if you put them here you don't need to re-login).

Radu Rădeanu
  • 166,822
  • 48
  • 327
  • 400
  • Yes, I know that I have to re-login, I did that multiple times (even rebooteed) but there there was absolutely no change... It worked in Ubuntu 12.10, why would it stop doing that? – szx May 30 '13 at 15:47
  • 1
    Can you please tell me what's wrong with my syntax as I can't see anything wrong? – szx May 30 '13 at 15:48
  • @szx What permission have you on this file? The result of `ls -l .pam_environment`? – Radu Rădeanu May 30 '13 at 17:08
  • `-rw-r--r--` ||||||||||| – szx May 30 '13 at 20:20
  • 1
    In my case it works by just having the assignement (not the pam_env syntax) in the files, like VAR=value. Maybe you have an encripted home dir? Check https://bugs.launchpad.net/ubuntu/+source/pam/+bug/584249 and related bugs... – Rmano Oct 10 '13 at 17:48
  • 1
    By the way, `.pam_environment` is better than `.profile` if you, like me, use a different shell like zsh. – Rmano Oct 10 '13 at 17:49