SSH Trust Testing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SSH Trust Testing
# 1  
Old 04-28-2014
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.
Code:
#!/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
Code:
 ssh -q -o "BatchMode=yes" test@test "echo 2>&1" && echo "OK" || echo "NOK"

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 04-28-2014 at 09:59 AM.. Reason: Code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Assistance with testing ssh connections and what the return codes mean

Hello Forum, I'm using a bit of code from a script I found that allows me to capture the status code of connecting via SSH to remote servers: ssh -qno StrictHostKeyChecking=no -o ConnectTimeout=1 user@$InputIP 'ls -l /home/user >/dev/null 2>&1' > /dev/null 2>&1 status="$(echo $?)" echo... (4 Replies)
Discussion started by: greavette
4 Replies

2. Linux

SCEP and Trust Anchor

Hi Does anybody knows about the simple certificate enrollment protocol details ? if yes please provide me the details. And what is a trust anchor profile ? Thanks in advance. (0 Replies)
Discussion started by: chaitus.28
0 Replies

3. UNIX for Dummies Questions & Answers

ssh trust issue

Hi, i am setting up ssh trust setup between two servers where SVRA is a solaris box and SVRB is a Red Hat Linux. It is asking for the password all the time. I have copied over the SVRA:/home/nagios/.ssh/id_dsa.pub as authorized_keys on to SVRB:/dat01/home/nagios/.ssh/ -bash-3.00$ ssh -vvv... (4 Replies)
Discussion started by: uxadmin007
4 Replies

4. HP-UX

Not Trust Host 10.10.10.10

I get a message similar to this, in the syslog file. Actually, I am trying to let the host at 10.10.10.10 access the HP-UX system. How do I get it trusted? Thanks! (2 Replies)
Discussion started by: instant000
2 Replies

5. Shell Programming and Scripting

Please Help: How to Call SSH Trust from Cron job.

Hi All, I am tring to excute a SSH trust command from a script which is invoked by crontab. Details: Crontab file contains the following line: 15 00 * * * /users/dummy_user/dummy_script1.sh dummy_script1.sh contains the following line: SSH -1 server_2... (4 Replies)
Discussion started by: suman82
4 Replies

6. Shell Programming and Scripting

Testing ssh connection from KSH script

Hi. I have a kornshell script that runs on a daily basis as a cron job. Part of what the script does is copy the folder contents from another server to the current server (server where KSH script is running). I have a scp command, as follows: scp $REMOTE_HOST:$REMOTE_FILE_DIR/* $TMP_DIR ... (8 Replies)
Discussion started by: dmilks
8 Replies

7. SuSE

ssh-keygen trust problem

OK, this is the problem. I have 2 machines TestA ( Suse 9.0 ) TestB ( Mandrake 10 ) and one of our guys wants to scp from TestA to TestB without the password prompt appearing. Sounds simple so far.... Ok, I haven't used ssh-keygen before, so I create identical logins to test what I'm doing...... (4 Replies)
Discussion started by: PaulC
4 Replies
Login or Register to Ask a Question