.bashrc at ssh login

Hobhouse picture Hobhouse · May 4, 2009 · Viewed 144k times · Source

When I ssh into my ubuntu-box running Hardy 8.04, the environment variables in my .bashrc are not set.

If I do a source .bashrc, the variables are properly set, and all is well.

How come .bashrc isn't run at login?

Answer

Ayman Hourieh picture Ayman Hourieh · May 4, 2009

.bashrc is not sourced when you log in using SSH. You need to source it in your .bash_profile like this:

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi