sshd and .bashrc
Mark Bartelt
mark at cacr.caltech.edu
Fri Jul 1 13:17:34 EST 2011
Actually, it doesn't surprise me at all that this has already
been discussed before. And I did try searching the archives
before sending my message; more on that below. But first, as
for the topic itself ...
The "bash" manpage is annoyingly vague about what the behaviour
should be. On the one hand, the "FILES" section talks about the
".bashrc" file as the "individual per-interactive-shell startup
file", which sort of implies that it's not used for connections
which _don't_ cause an interactive shell to be run. But on the
other hand, elsewhere it says ...
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.
That wording ("usually rshd") is obviously quite dated, but one
could certainly argue that sshd _is_ the "remote shell daemon"
these days. So it just seems better (to me, at least) if sshd
would ensure that bash's behaviour were consistent with what's
in the manpage.
One could fault the distributors of "bash", for not making the
"#define SSH_SOURCE_BASHRC" a default. But even so, I really
don't understand why having sshd's default be _not_ to define
USE_PIPES wouldn't be sensible, letting people define it when
their environment requires it.
And regardless of whether the consensus is that it's better to
have it defined or not to have it defined, it just seems unwise
to have that "#define USE_PIPES" buried down in the middle of a
.c file, rather than at the very top, or (better) in a .h file;
wouldn't that be more conformant with good C programming style?
Finally, regarding the archives ... I actually did try doing a
search. But when I asked it to search for "USE_PIPES", after it
displayed the results my "USE_PIPES" in the search box had been
replaced by "pipes", and the browser window title bar displayed
"'pipes' in openssh-unix-dev", so for some reason it looked like
it was chopping off part of the search term I gave it (even when
I enclosed it in quotes), so it wasn't clear what fraction of the
search results it was displaying would be relevant.
If I entered "USE_PIPES" and ".bashrc" in the search box, it gave
me four messages from April 2009, but those seemed to be dealing
with whether socketpairs and pipes could be mixed in channels.c,
so didn't necessarily seem relevant. (And the thread topic was
"ssh localhost yes | true (follow up)", which also didn't seem
like it was coconnected to the .bashrc issue.)
Maybe better search criteria would have turned up the relevant
old threads. But just offhand, do you happen to know why their
search engine seems so insistent on transforming "USE_PIPES" to
just plain "pipes"?
---------------
Mark Bartelt
Center for Advanced Computing Research
California Institute of Technology
Pasadena, California 91125
626 395 2522
626 584 5917 fax
626 628 3994 e-fax
mark at cacr.caltech.edu
http://www.cacr.caltech.edu/~mark
More information about the openssh-unix-dev
mailing list