On login, bash runs scripts in your home directory depending on a number of factors. Note these scripts don’t seem to require being set executable. A summary, as far as I can make out (tested on Debian lenny):
/etc/profile always seems to be run first /etc/bash.bashrc will be run next for interactive shells (aka not scripts or su -c) If the shell has been started with the command /bin/sh, bash emulates the older sh shell and runs the ~/.profile script A ssh login (and presumably also local login) runs ~/.bash_profile , or if it can’t be found ~/.bash_login or .profile, if they exist (~/.profile being last) Graphical terminal emulators usually run ~/.bashrc The command su username from a shell runs ~/.bashrc The command su -c “command” username from a shell or script doesn’t run any of the scripts (except /etc/profile as always) The command su -l -c “command” username runs ~/.bash_profile (the -l flag to su emulates a login shell, so the other possibilities mentioned above if .bash_profile doesn’t exist)