Logging in to an SSH server as root is a no-no in many organizations because they want to be able to audit which “real” user actually accessed the server. So a typical scenario is a user connects with a private key to the SSH server and then uses sudo to do “root” stuff.
I believe the default for SSH server’s configuration is to log things with a level of
INFO, which creates the following entry in a system’s log when I log in:
Henk Jan Agteresch tells us to change the log-level to
VERBOSE in order to record the fingerprint of the public key used for authentication. Indeed, if I change that setting in
LogLevel VERBOSE, I see:
Those fingerprints indeed match my key: (I’m assuming the duplicate entry is a bug.)
My key’s fingerprint is also logged thusly when I attemt to login as “root”.
If an administrator keeps a record of users’ key fingerprints (s)he can easily determine which user accessed the server. This record can be kept in any convenient database, or if you use and LDAP directory server for user information, why not store the fingerprints in a multi-valued attribute type in the directory, allowing easy retrieval of user information from the key fingerprints? Just a thought.
Martin Schmitt has a utility which parses logfiles for key fingerprints and determines the username from users’
authorized_keys files in their home directories (on the same machine).