How to view and check who currently login using SSH
- Wednesday, July 14, 2010, 18:10
- Linux
- Add a comment
|
|
This could be viewed by the following procedure.
lsof command is used to list open files like disk files, pipes, network sockets and devices opened by all processes.So we are using this concept to view ssh connections to our machine.
Commands used are :
#lsof -i :22
OR
#lsof -i :ssh
OR
#lsof |grep :ssh
All these commands will display the active ssh connections to our machine as shown below
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 1892 root 3u IPv6 4966 TCP *:ssh (LISTEN)
sshd 14382 root 3r IPv4 56404 TCP 192.168.0.195:ssh->192.168.0.57:directvdata (ESTABLISHED)
Source: Lynuxstuff.com


