Tux

...making Linux just a little more fun!

An ssh puzzle

Neil Youngman [ny at youngman.org.uk]


Fri, 12 Nov 2010 15:57:20 +0000

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 output

$ 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?

Neil Youngman


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Fri, 12 Nov 2010 11:15:47 -0500

On Fri, Nov 12, 2010 at 03:57:20PM +0000, Neil Youngman wrote:

> 
> 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?

I agree with you - it seems to be some kind of STDOUT/STDERR bug. The two questions that would pop up for me would be 1) is the shell being used the same one as on the other hosts, and 2) has someone managed to crawl into my system and replace the shell with something just a little different? Little bits of misbehavior like that can be indicative.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * https://LinuxGazette.NET *


Top    Back