bug-bash
[Top][All Lists]
Advanced

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

Re: why does bash not execute .bashrc with ssh -t ?


From: Jon Seymour
Subject: Re: why does bash not execute .bashrc with ssh -t ?
Date: Thu, 16 Oct 2008 02:06:36 +1100

Chet,

Thanks for that info.

Due to the circumstances, recompiling bash isn't really an option for me, so
I decided to deal with it by having ssh invoke a script that could guarantee
~/.bashrc was sourced.

Regards,

jon seymour.

On Wed, Oct 15, 2008 at 1:24 PM, Chet Ramey <chet.ramey@case.edu> wrote:

> Jon Seymour wrote:
>
> >     Bash attempts to determine when it is being run by the remote shell
> > daemon, usually rshd.  If bash determines it is being run by rshd, it
> > reads  and  executes
> >     commands  from  ~/.bashrc,  if that file exists and is readable.  It
> > will not do this if invoked as sh.  The --norc option may be used to
> inhibit
> > this behavior, and
> >     the --rcfile option may be used to force another file to be read, but
> > rshd does not generally invoke the shell with those options or allow them
> to
> > be specified.
> >
> > However, when I use the ssh -t option, it would seem that allocation of a
> > pseudo-tty is causing bash to assume that it is not being invoked by a
> > remote shell daemon.
>
> Correct.  One of the criteria bash uses to decide whether it's being
> invoked by rshd or sshd is that its stdin is a socket.  Allocating a
> pseudo-tty makes that false.
>
> You can force bash to source .bashrc when it finds the various ssh
> variables in its startup environment by defining SSH_SOURCE_BASHRC
> in config-top.h and rebuilding bash.  That will cause .bashrc to be
> sourced more times than it should, but it will catch the cases you
> are interested in.
>
> Chet
>
> >
> > Is there any way I can have an ssh pseudo-tty and get bash to execute
> > ~/.bashrc?
> >
> > jon seymour.
>
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>
> Chet Ramey, ITS, CWRU    chet@case.edu
> http://cnswww.cns.cwru.edu/~chet/ <http://cnswww.cns.cwru.edu/%7Echet/>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]