Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to resolve, which public key is used to grant user access to a server?

For example, there are 5 public keys stored in ~/.ssh/authorized_keys file. I'd like to know which key has the most frequency of usage and count every auth event based on keys instead of auth by password.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You can adjust the SSH debug level to be more verbose, and the key fingerprints will be included in the logs. Unfortunately this will also include some other noisy messages that you probably won't care about.

You need a LogLevel of Verbose or higher to see the fingerprint.

# tail -50 /var/log/auth.log
Mar 14 10:01:22 myhost sshd[22092]: Found matching RSA key: 79:53:3a:31:56:e4:61:...
Mar 14 10:01:24 myhost sshd[22092]: Found matching RSA key: 79:53:3a:31:56:e4:61:...
share|improve this answer
    
See this answer for how to convert your authorized_keys into a list of fingerprints. –  Zoredache Mar 14 '11 at 17:05
    
+1 We do exactly this to satisfy certain security audit requirements –  freiheit Mar 14 '11 at 17:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.