[EMAIL PROTECTED] wrote:
> when using ssh in a ksh script where previously configured public key auth
> is expected but not always the case, i want to have ssh commands that
> prompt for a password to be handled as errors and exit the script. the
> idea is to not have anyhing printed to the console and to exit with a
> non-zero error code instead of a password prompt, etc.
> 
> clues on how to do this are appreciated.

Sounds like you want LogLevel=QUIET and Batchmode=yes.  eg:

$ ssh -o PreferredAuthentications=password -o LogLevel=QUIET \
        -o BatchMode=yes localhost
$ echo $?
255

You can also put them in ~/.ssh/config or ssh_config.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

Reply via email to