Load ~/.bashrc on SSH
Contents
On SSH login, ~/.bashrc
was not load
Why?
- A login shell first reads
/etc/profile
and then~/.bash_profile
.- A non-login shell reads from
/etc/bash.bashrc
and then~/.bashrc
.An ssh command which does have a command, like
ssh user@host
, It will start a login shell, a login shell reads~/.bash_profile
.An ssh command which does have a command, like
ssh user@host :
(:
is command that does nothing), It will not start a login shell, therefore ~/.bashrc is what will be read.
Ref. Stackexchange - Why does remote Bash source .bash_profile instead of .bashrc
In my environment, there are no description in ~/.bash_profile
to load ~/.bashrc
.
files
man bash
has following description by the way.
|
|
Fix
Add below in ~/.bash_profile
.
|
|
Then bashrc is loaded on SSH login to ubuntu.