SSH Trust Testing

Hi,

I want test the ssh trust between two host. It works fine if the trust is working fine but if the trust is not working fine it gets stuck.

#!/bin/sh
>/users/test/ssh.txt

for i in `cat /users/test/host.txt`; 
do
ssh test@$i uname -a  >> /users/test/ssh.txt
test=`cat /users/test/ssh.txt | awk '{print $2}'`
echo $test
if [ "$test" == "$i" ]; then
echo "Pass"
else 
mailx -s "Trust not working between $HOSTNAME and $i " -c abc@abc.com abc@abc.com  <<EOF
EOF
fi
>/users/test/ssh.txt
done

I tried keep keeping timeout but that also is not working fine. I want to the script to send me mail when the trust is not working which means if the ssh user@host keeps waiting for password for more than 10 secs if should trigger an email.

---------- Post updated at 06:24 PM ---------- Previous update was at 05:36 PM ----------

Ignore the above thread . I got the answer

 ssh -q -o "BatchMode=yes" test@test "echo 2>&1" && echo "OK" || echo "NOK"