bug-bash
[Top][All Lists]
Advanced

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

Re: ssh does not source /etc/bash.bashrc, but manual execution of /bin/b


From: Nick
Subject: Re: ssh does not source /etc/bash.bashrc, but manual execution of /bin/bash does it under specific circumstances
Date: Tue, 20 Dec 2016 20:58:10 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

Hello Chet and Eduardo,

thank you very much for your replies. Everything is crystal clear now.
Sorry for the 'wrong alarm' (:

Best,
Nick

On 20/12/2016 20:24, Chet Ramey wrote:
On 12/20/16 11:11 AM, Nick wrote:

         i came up with a weird behavior of ssh+bash on my Debian box (8.6).
         I created an alias in /etc/bash.bashrc file, which is sourced through 
/etc/profile.
         Everything worked fine, till i decided to remove the '. 
/etc/bash.bashrc' line from /etc/profile.
         When i` m connected via ssh the '/etc/bash.bashrc' is not sourced and 
the alias does not work as expected.
         But, when i execute bash from my shell, the '/etc/bash.bashrc' seems 
to be sourced and the alias is there (please find bellow a demo)
ssh without a command is equivalent to slogin, which starts a login shell
on the remote host.  Login shells don't execute ~/.bashrc (and, if so
configured, SYS_BASHRC), so there's usually a line to source it in one of
the login shell startup files (/etc/profile in your case).  That's why
it's there, and that's why removing it had the effect you observed.

         Not sure if i miss something (f.x. bash is executed with different 
flags while being called from ssh versus a user), but as far as i understand, 
the same things should be (or not) sourced.
Well, it's the difference between a login shell and a non-login interactive
shell.





reply via email to

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