I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1.
When I do a who -m from A2, I see the "connected from" as "A1".
=> who -m
userid pts/2 2010-03-27 08:47 (A1)
I want to identify who is the local host who initiated the connection to remote host A2.
Is there a tool that would help me find it in a easy way
I'd look for the $SSH_CONNECTION variable in your environment.
# echo $SSH_CONNECTION
172.16.0.201 1840 172.16.0.202 22
SSH_CONNECTION gives me the last remote host from where I hopped.
I would like to find which local host initiated it. In my example, sitting on A2 host, i want to find that L1 originated the connection, eventhough i hopped to A1 first.
Now SSH_CONNECTION from A2 shows A1 and not L1.
Dont think you would be able to get that information. Your first SSH terminates on A1, and you create a completely new one from there to A2 - why would you think A2 would know about L1?