I
I
index0h2015-02-05 18:14:38
linux
index0h, 2015-02-05 18:14:38

How to find out which of the keys is logged in via ssh?

Input data: there is 1 user on the server ((and many ssh keys under which users sit. It is necessary to match the current session with such and such a key.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konkase, 2015-02-05
@Konkase

[[email protected] /]# ps aux | grep "sshd: root"
root      8039  0.0  0.1 135632  4924 ?        Ss   17:00   0:00 sshd: [email protected]/0
[[email protected] /]# grep 8039 /var/log/secure
Feb  5 17:00:47 node1 sshd[8039]: Accepted publickey for root from 192.168.18.41 port 33842 ssh2: DSA of:09:k6:m7:q0:qw:1q:26:01:t3:r4:6h:h6:b7:az:1w
Feb  5 17:00:47 node1 sshd[8039]: pam_unix(sshd:session): session opened for user root by (uid=0)

I
Igor, 2015-02-05
@merryjane

You need to run through your file with the keys and get all the available fingerprints, and then compare them with those in the logs.
You can get fingerprints like this:
serverfault.com/questions/413231/how-to-get-all-fi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question