OpenSSH solaris: bad return code after exec of remote command

Matthew Seaman matthew.seaman at tornadogroup.com
Wed Oct 10 21:15:31 EST 2001


Markus Friedl wrote:
> 
> On Wed, Oct 10, 2001 at 11:09:17AM +0100, Matthew Seaman wrote:
> > i) SSH2 protocol
> > ii) Using a forced command
> > iii) No stdin on the client --- ie. using `ssh -n' or
> > `ssh host commands </dev/null'.
> 
> i don't see how forced commands should change things here.
> 
> but, yes there are issues with getting the return code from the
> child in ssh2.
> 
> what does
>         for i in  4 7 44 77; do
>                 ssh -n host exit $i
>                 echo $?
>         done
> print for you?

Without a forced command we get 255 consistently:

sw-web-2:~$ ssh-add -l 
1024 e5:0d:e6:b0:c3:26:5f:f7:3d:f6:28:1e:8a:cc:09:98
/export/home/matthew/.ssh/id_dsa (DSA)
sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
255
255
255
255
sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
255
255
255
255
sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
255
255
255
255
sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
255
255
255
255

With a forced command (/bin/df /tmp) we seem to get either 255 or
occasionally 0:

sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
/tmp               (swap              ): 9723200 blocks   437218 files
255
/tmp               (swap              ): 9723200 blocks   437218 files
255
/tmp               (swap              ): 9723200 blocks   437218 files
0
/tmp               (swap              ): 9723200 blocks   437218 files
255
sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
/tmp               (swap              ): 9723200 blocks   437218 files
255
/tmp               (swap              ): 9723152 blocks   437218 files
0
/tmp               (swap              ): 9723152 blocks   437218 files
255
/tmp               (swap              ): 9723200 blocks   437218 files
255
sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
/tmp               (swap              ): 9723152 blocks   437218 files
255
/tmp               (swap              ): 9723104 blocks   437218 files
255
/tmp               (swap              ): 9723200 blocks   437218 files
255
/tmp               (swap              ): 9723200 blocks   437218 files
255
sw-web-2:~$ for i in 4 7 44 77 ; do ssh -n sw-web-1 exit $i; echo $?;
done
/tmp               (swap              ): 9723120 blocks   437218 files
0
/tmp               (swap              ): 9723168 blocks   437218 files
255
/tmp               (swap              ): 9723168 blocks   437218 files
255
/tmp               (swap              ): 9723184 blocks   437218 files
255

	Cheers,

	Matthew

-- 
Matthew Seaman                                              01628 498661

                Abeo, abeo, abeo, actum est, comites!



More information about the openssh-unix-dev mailing list