Determine when someone last logged in to a server from a key
Solution 1:
You need to increase the LogLevel
in /etc/ssh/sshd_config
to VERBOSE
and restart sshd. This will cause sshd to log the fingerprint of the key being used to whichever log file your sshd is configured to use e.g.
Jan 7 22:46:17 host.lan sshd[5998]: Connection from 192.168.254.187 port 57062
Jan 7 22:46:17 host.lan sshd[5998]: Found matching RSA key: 54:d2:06:cf:85:ec:89:96:3c:a8:73:c7:a1:30:c2:8b
Jan 7 22:46:17 host.lan sshd[5998]: Found matching RSA key: 54:d2:06:cf:85:ec:89:96:3c:a8:73:c7:a1:30:c2:8b
Jan 7 22:46:17 host.lan sshd[5998]: Accepted publickey for user from 192.168.254.187 port 57062 ssh2
It should be fairly straight forward to match the key fingerprint to the key and do what you want.