I'm getting confused by the SSH sessions which are logged in from different places under the same user name. Is it possible to distinguish them somehow? For example, can I configure to annotate the remote IP address in the process table at the ← mark?

root       /usr/sbin/sshd -o PidFile=/var/run/sshd.init.pid
root         sshd: user [priv] ←
user          sshd: user
root         sshd: user [priv] ←
user          sshd: user@pts/3
user            -bash
user              /bin/ps -AH -o user,cmd
link|improve this question
Could you perhaps give a better example as to why you're needing this? My first reaction was to wonder if you're trying to distinguish between multiple individuals using the same account - which should not be generally allowed. – Iszi Rory or Isznti Dec 14 '10 at 21:29
feedback

2 Answers

You can use netstat -p or ss -p to match connection IP/ports with process ids; netstat shows just the sshd: user [priv] process, ss shows both of them.

link|improve this answer
feedback
up vote 0 down vote accepted

w -f shows the remote addresses, but also the tty names. For my situation, this is preferable over netstat/ss because I can match the sessions much more quickly with the process list.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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