Obtain fingerprints for all ssh-rsa keys in authorized_keys file

Posted on 2009-12-16
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
    LVL 33

    Accepted Solution

    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
    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

    Worked great, thanks.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    A quick step-by-step overview of installing and configuring Carbonite Server Backup.
    When the confidentiality and security of your data is a must, trust the highly encrypted cloud fax portfolio used by 12 million businesses worldwide, including nearly half of the Fortune 500.
    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…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now