How to view and check who currently login using SSH

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

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Related Posts

  • No Related Post
Related Posts with Thumbnails

About the Author

CoreTimer

has written 31 stories on this site.

System administrator(Linux/UNIX/Windows) RHCE,MCP,CCNA

Write a Comment

Copyright © 2012 CoreTimer.com|System Admin’s Reference. All rights reserved.

Switch to our mobile site