$ sudo head -1 myprivatekey.key
-----BEGIN ENCRYPTED PRIVATE KEY-----
The problem is that I don't know which password is correct because I have a few. If we are using
openssh
, we can easily verify if a password is correct by using ssh-keygen
with the -y
option -- the manual states,
-y This option will read a private OpenSSH format file and print an
OpenSSH public key to stdout.
Knowing this, we verify whether a password is correct or not by
ssh-keygen -y -f ./myprivatekey.key; echo "exit code is " $?
Enter passphrase: xxxxxxxx
Load key "./myprivatekey.key": incorrect passphrase supplied to decrypt private key
exit code is 255
which shows that the password I entered was incorrect. However, we entered a correct one, we would observe,
ssh-keygen -y -f ./myprivatekey.key; echo "exit code is " $?
Enter passphrase: yyyyyyyy
exit code is 0
No comments:
Post a Comment