I have over 200 servers, but is hard to keep tracking all of them by some documents, after a while it gets outdated, so to refresh this document, I have to know which servers I can login via SSH
.
I already create a script which gonna ping through a range of IP address, with this list now I would like to know if I can SSH into them. I was thinking in a combination of sshpass
and ssh
inside a loop, but wonder if that's the best solution.
Any idea or suggestion ?
dawud's suggestion is good, you can also pass a list of servers to
ssh-keyscan
to scan them and log the server's public key.Use some monitoring program like Nagios for this instead of writing your own scripts. It will alert you if some server goes down.