--- Greg Wooledge wrote:
> Or, you could run a separate instance of sshd on another port, with no
> banner enabled, and have your scripts connect to the alternative port.

Yeah that's an idea.

> > But that traps the SSH banner and I always get "Problem" even when the command was successful.

> You're checking the exit status of the ssh process. You're not checking
> the output of the command. So your last sentence makes no sense.
> If your code had actually read:
> ssh user@server command > good_output 2> errors.txt
> if [ -s errors.txt ]; then
> email "Command successful."
> else
> email "Problem"
> email errors.txt
> fi
> *then* your last sentence would have made sense. But it doesn't.

Oops, good catch. I forgot to mention I'd already tried that.

That doesn't work because the banner gets sent to the 2 file descriptor. The errors.txt file
/always/ has content, so this test is useless:
if [ -s errors.txt ]

Try it and see.

Anyway, I think I have a workaround. Trap errors to errors.txt on the server side and then scp it
back to the client. Kludgy, but so far it's working.

I wrote this list because I was looking for a flag within the SSH client itself, and apparently
there is not one.


Are you good enough?