[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: remote access via ssh?



On Thu, Aug 24, 2006 at 12:06:35PM -0400, Ishwar Rattan wrote:
> Remote system is debian derivative. When I access this system
> using ssh, the connection does not execute $HOME/.bashrc
> on remote system.

My .bash_profile starts with

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

According to the bash manpage, 

       When  bash is invoked as an interactive login shell, or as a non-inter-
       active shell with the --login option, it first reads and executes com-
       mands  from  the file /etc/profile, if that file exists.  After reading
       that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
       in  that order, and reads and executes commands from the first one that
       exists and is readable.

       ...

       When an interactive shell that is not a login shell  is  started, bash
       reads  and  executes  commands  from /etc/bash.bashrc and ~/.bashrc, if
       these files exist.

I would assume that logging in via ssh gives you an interactive login
shell, therefore bash will only execute .bash_profile and not .bashrc.
The clause from my .bash_profile shown above "fixes" that by making
.bashrc run for all interactive shells, whether login shells or not.

-- 
The freedoms that we enjoy presently are the most important victories of the
White Hats over the past several millennia, and it is vitally important that
we don't give them up now, only because we are frightened.
  - Eolake Stobblehouse (http://stobblehouse.com/text/battle.html)



Reply to: