openssh-SNAP-20001207 scp "Bad file descriptor" sort-of work-around
James
james at amethyst.nurealm.net
Fri Dec 8 07:54:48 EST 2000
Damien wrote:
> Do you have something in your profile or shell rc which causes text to
> be displayed on non-interactive logins?
No, but there's part of where the problem is. scp seems to read /etc/passwd
on the _target_ server machine (as well as on the client machine) to
determine the user's default shell on that target machine, and then invokes
a non-login _interactive_ shell, NOT a non-interactive shell.
I know this from changing the various scripts and the /etc/passwd login
shell for the user (root). Where man bash has
INVOCATION
A login shell is one whose first character of argument
zero is a -, or one started with the -login flag.
An interactive shell is one whose standard input and out
put are both connected to terminals (as determined by
isatty(3)), or one started with the -i option. PS1 is set
and $- includes i if bash is interactive, allowing a shell
script or a startup file to test this state.
Login shells:
On login (subject to the -noprofile option):
if /etc/profile exists, source it.
if ~/.bash_profile exists, source it,
else if ~/.bash_login exists, source it,
else if ~/.profile exists, source it.
On exit:
if ~/.bash_logout exists, source it.
Non-login interactive shells:
On startup (subject to the -norc and -rcfile options):
if ~/.bashrc exists, source it.
My ~/.bashrc normally starts with "source /etc/profile", which was what
actually generated the text, and the "sshd[3381]: error: select: Bad file
descriptor" message in the log file. (I noticed that if I simply put echo
"a bunch of random characters asdlfkjsd" into ~/.bashrc, that will also kill
scp, but - and only in this particular case - without the "Bad file
descriptor" error message.)
I suppose I can try to modify ~/.bashrc to check how it's being called, but...
Could this be a problem with bash? or a problem with how sshd calls the
login shell?
# echo $BASH_VERSION
1.14.7(1)
> What does "ssh localhost true" say?
On the client machine:
# ssh localhost true
ssh_exchange_identification: Connection closed by remote host
with "sshd[25040]: refused connect from 127.0.0.1" in the log file.
On the server machine, the same. Also the same if 127.0.0.1 is added to
/etc/hosts.allow for sshd. Also the same for a non root user.
> You mustn't have junk being printed for non-interactive sessions.
What's the easiest way to invoke a for-sure non-interactive session for
testing?
Again, please Cc me on any response, as I'm not subscribed to the list.
Thanks.
James Feeney
More information about the openssh-unix-dev
mailing list