Is there a simple way to get a list of all fingerprints entered in the .ssh/authorized_keys || .ssh/authorized_keys2 file?
ssh-keygen -l -f .ssh/authorized_keys
will only return fingerprint of first line / entry / publickey
hack with awk:
awk 'BEGIN {
while (getline < ".ssh/authorized_keys") {
if ($1!~"ssh-(r|d)sa") {continue}
print "Fingerprint for "$3
system("echo " "\""$0"\"> /tmp/authorizedPublicKey.scan; \
ssh-keygen -l -f /tmp/authorizedPublicKey.scan; \
rm /tmp/authorizedPublicKey.scan"
)
}
}'
but is there an easier way or ssh command I didn't find?
Best Answer
Here's another hack using plain bash without temporary files:
You can easily make it a function in your
.bashrc
:and call it with: