OpenSSH solaris: bad return code after exec of remote command
Matthew Seaman
matthew.seaman at tornadogroup.com
Wed Oct 10 20:09:17 EST 2001
David Batterham wrote:
> I am using openSSH (now 2.9.9p2, but prob occurs in 2.9p2 also) to execute
> commands on a remote machine which outputs data to stdout then pipes it to
> another invocation of ssh which connects back to the first machine in the same
> way, where it starts a program to read and store the output from the command on
> the second machine. I am using the "command" option in the keys file to force
> execution of a particular command when that key is used for authentication.
>
> My problem is this. The remote ssh returns an error code of 255 (using echo $?),
> or (-1 in the debug), despite the command executing successfully. about 5-10% of
> the time it returns 0. In all cases it "appears" the command completed
> successully, and is simply an issue of ssh failing to close the channel cleanly.
> My guess is that one side is closing before the other acknowledges and therefore
> thinks the channel has been prematurely terminated.
>
> My questions are: How sure can I be that I am indeed getting all data from the
> pipe? How can I accurately determine the exit status of the command (ufsdump)
> which is piping data into ssh, regardless of ssh's exit status ? Has anyone else
> seen this problem and/or resolved it ?
Damn. Synchronicity or what. We've just been struggling with a similar
problem and I was just about to post a bug report when I saw this
message.
What we've been able to determine:
You'll always get a failure exit code from ssh if the following three
things are true:
i) SSH2 protocol
ii) Using a forced command
iii) No stdin on the client --- ie. using `ssh -n' or
`ssh host commands </dev/null'.
Work around is to use rsa1 keys and SSH1.5 protocol.
Verified using OpenSSH 2.3.0p1, 2.9p1, 2.9.9p2 on Solaris 8. We'll be
glad to supply more detailed debugging output or whatever on request.
Matthew
--
Matthew Seaman 01628 498661
Abeo, abeo, abeo, actum est, comites!
More information about the openssh-unix-dev
mailing list