Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I struggle to see the difference between pam_env.conf and /etc/environment. To me they both do the same thing, with a difference syntax. The manpages were no help. So what is the difference?

Additionally, I'd like to find a way to add paths to the PATH environment variable for all users. Adding them to the two aforementioned files works for all users, but doesn't work with sudo, as can be verified by running sudo sh -c 'echo $PATH'.

To solve that problem, I believe I should edit the file /etc/pam.d/sudo, but what should I put in there?

share|improve this question

I managed to get more or less what I wanted for sudo:

I edited the /etc/sudoers file (with sudo visudo) and commented out the lines Default env_reset and Default secure_path = ....

Now sudo will use the user's environment.

The difference between pam_env.conf and /etc/environmentstill isn't clear to me tough, so the question is not yet answered.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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