Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|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 Dec 14 '10 at 21:29

2 Answers 2

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.

share|improve this answer
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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