ssh - How to quickly check if a private rsa key still works for a bunch of servers in bash? -
I have a list of several servers if key on private hand can still be used to login with SSH There is a need to check (actually does some work on them).
If I use the ssh -i / path / to / private_key administrator @server_host
. It just keeps asking for the password: password for admin @ server_host:
What can I do to avoid this kind of lightness, and gather information? When the private key does not apply to this server?
You can tell ssh to allow password authentication to be used:
For this reason, SSH will exit immediately if private key does not work.If you want to exclude it even if you succeed, just add that command to the end:
ssh -i / path / to / private_key -o Password authentication = any admin @ server_host exit
Comments
Post a Comment