Linux

Bash.rc And Environment Variables Not Loading On SSH

Posted by Weston Ganger on May 31, 2015

I was having some issues with my .bashrc file not being loaded when SSHing.

To fix it add this to the beginning of your .profile file.


# ~/.profile

# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
  . "$HOME/.bashrc"
fi

Also if you are running a non-interactive SSH shell such as when using Capistrano or another tool, you must make sure you set your variables before this line in your .bashrc


# ~/.bashrc

# PLACE YOUR ENVIRONMENT VARIABLES HERE

# If not running interactively, don't do anything
[ -z "$PS1" ] && return


Related External Links:


Posted in Linux and Tagged with bash ssh capistrano 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts