Files with the .sh extension in the /etc/profile.d
directory get 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.
You can for instance create the file /etc/profile.d/myenvvars.sh and set variables like this: Suppose my jdk1.7.0 in folder /home/approved/Downloads sudo -i (type password) cat >/etc/profile.d/myenvvars.sh (and press) export JAVA_HOME=/home/approved/Downloads/jdk1.7.0 export PATH=$PATH:$JAVA_HOME/bin (and press) Ctrl+D