Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I understand that the former is used prior to the latter, but what is the conceptual difference? Is there any good reasons I should set some variables in one and not in other? Except the fact that /etc/environment seems to exist to set up environment for all processes run by the system, while /etc/profile is for setting up environment used and propagated from the login shell, correct?

Also, on a side note, which program traditionally reads /etc/environment? I mean which program I cannot find any good references by googling. Is it related to POSIX, or just a convention?

share|improve this question
add comment

2 Answers

/etc/enviroment is not part of posix it belongs to pam and only programs compiled with pam support are able to use it, this means it isn't even read by your shell.

You can see the programs using /etc/enviroment with grep -l pam_env /etc/pam.d/*.

So /etc/environment is used for setting variables for programs which are usually not started from a shell.

share|improve this answer
add comment

Extract from The Ubuntu help

/etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.

/etc/profile - This file gets executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the DisplayManager when the desktop session loads.

I think all this is just a convention but not far from a standard (I don't know about RedHat like systems ).

share|improve this answer
add comment

Your Answer

 
discard

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.