Obtain fingerprints for all ssh-rsa keys in authorized_keys file

Posted on 2009-12-16
Medium Priority
Last Modified: 2012-08-14
I have an single authorized_keys file with about 50 public keys in it. I would like to periodically obtain the key fingerprints for each of those to cross-reference against a log file. Is there a utility (or a series of utilities)  to export this information? Doesn't need to be batch-friendly, a GUI would be fine if that's all there is available.

Environment: Win 2003 server SP2, copssh 2.1.0 (cygwin1.dll v1.5.25)

"ssh-keygen -l -f keyfile" does not work - it just gives me a single hash.

Question by:team170
  • 2
LVL 33

Accepted Solution

Dave Howe earned 2000 total points
ID: 26070957
there is no trivial command to do this - however, you can easily write a small bit of script.

consider the following:
cat ~/.ssh/authorized_keys | while read a b c
echo $a $b $c > tmp_auth_key
ssh-keygen -lf tmp_auth_key | sed "s/tmp_auth_key/$c/"
rm tmp_auth_key

Open in new window

LVL 33

Expert Comment

by:Dave Howe
ID: 26070970
oh, and in case you are wondering, the sed bit is there to convert the file name into the key comment in the output, for readability :)

Author Closing Comment

ID: 31667071
Worked great, thanks.

Featured Post

Cyber Threats to Small Businesses (Part 2)

The evolving cybersecurity landscape presents SMBs with a host of new threats to their clients, their data, and their bottom line. In part 2 of this blog series, learn three quick processes Webroot’s CISO, Gary Hayslip, recommends to help small businesses beat modern threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This article covers the basics of data encryption, what it is, how it works, and why it's important. If you've ever wondered what goes on when you "encrypt" data, you can look here to build a good foundation for your personal learning.
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question