SSH – Fix rc Files Not Being Read

bashssh

Once upon a time, an ssh invocation to host1 like ssh u@host1 command would read .bashrc before executing command. host2 is administered by the same people, and reads .bashrc!

I don't administer host1 or host2, but sometime in the last 6 months it seems this behaviour has changed.

It seems now that no rc file is being read on login: I edited .profile, .bash_profile, .bashrc, .login to append their name to a variable when read (export READ=$READ:.profile)

The results surprised me:

> ssh u@host1
bash3.2> echo $READ
:.bash_profile:.profile 

As I expected.

> ssh u@host1 echo \$READ

>

So now I'm stuck. Any suggestions on how this could be happening? Is this a SSHd settings issue?

And just for info: host2 is running a version of OpenSSH even older than host1, and both are running the same bash version. host1 runs AIX, host2 runs linux.

Edit: I can't change the ssh command line because the goal here is to make git work properly, for a couple of non-super-users, where git is installed (for other reasons) on a non-standard path. The relation to this question is that because the location of git-unpack is specified in .bashrc, git clone from this remote has stopped working. So the RC problem needs to be fixed, because I'm trying to set this up for non-super-users, and so git-clone -u is not really a satisfactory answer.

Best Answer

In this particular instance, the answer appears (unfortunately) to be an instance of buggy software (or a bug very similar to that linked one).

If you control bash on that machine, you may be able to fix it by recompiling bash with #define SSH_SOURCE_BASHRC; However it's not the case for me, so I'm stuck seeking other options.

Hopefully that helps someone.

Related Question