Hello,
I am writing a script that has to log in to X number of servers over a full C class range.
I am only keyed on a certain number of these servers and this can change from time to time.
The part of my script that deals with this is
for i in $(cat $server_list); do
ssh root@$i "Run commands!"
done
If I connect to a server that I am not keyed on I get a password prompt. Is there a way (return code?) that I can detect this and then move on to the next server? Or does anyone know a way I can add some sort of timeout to the script?
Regards,
Colin
---------- Post updated at 09:39 PM ---------- Previous update was at 03:48 PM ----------
ssh -o PreferredAuthentications=publickey root@1.2.3.4
if anyone is interested