I want to test the validity of an ssh passphrase-protected identity file against a given host. I do not want to actually provide the passphrase nor do I necesarily know it, just verify that the identity file itself is even applicable at all to the remote host in question.
Consider the following examples:
ssh -i .ssh/right-key.pem user@some_host
Enter passphrase for key '.ssh/right-key.pem':
ssh -i .ssh/wrong-key.pem user@some_host
Permission denied (publickey).
When I use the valid key, I get prompted for a passphrase. When I use the invalid key there is no prompt but an error is returned right away. Some how ssh knows that one of these keys would apply and the other does not. I want a simple way to perform this test.
How would I do this? Thank you!