[TAG] An ssh puzzle
ny at youngman.org.uk
Fri Nov 12 18:57:20 MSK 2010
I have a glitch that's stumped both me and my sysadmin.
I wanted to know which hosts a particular file that needed updating was on and
I thought this simple loop would answer that question.
$ for n in `seq 1 25`; do ssh host$n ls -l /path/to/file; done
This worked for the first 4 hosts, ten it got to the 5th host where it
displayed the banner and hung. Trying it directly as a simple command;
$ ssh host5 ls -l /path/to/file
also hung after displaying the banner.
$ ssh host5
allowed me to log in normally and
$ ls -l /path/to/file
showed that the file did not exist on host5.
Next I tried
$ ssh echo foo
which worked normally, so I tried
$ ls -l /bin/sh
which also worked normally.
$ ssh host5 strace ls -l /path/to/file
didn't hang either and I couldn't see anything that struck me as odd in the
$ ssh 'host5 ls -l /path/to/file 2> /dev/null'
did not hand ang modifying it to
$ ssh 'host5 ls -l /path/to/file 2>&1'
allowed me to see the error message.
The problem seems to be related in some way to the handling of standard error,
but I can't think of anything that would cause it to behave like that. I have
a workaround that gets me the information I need, but I would like to resolve
the underlying problem. Do any of the gang have any idea what could cause
this sort of behaviour?
More information about the TAG