09-05-2015 12:41 PM - edited 03-08-2019 01:39 AM
What command can I use to view who log into a switch.
09-05-2015 03:05 PM
sh users
09-06-2015 01:42 AM
As jdamon113 says, the show users command will tell you which users are currently logged in, including the user running the command indicated with an asterisk (*).
c1kv-1#sh users Line User Host(s) Idle Location 1 vty 0 admin idle 00:02:27 192.168.1.78 * 2 vty 1 admin idle 00:00:09 192.168.1.78
It's not clear from the question, but if you need to know which user has logged in / out and when, you can use the login on-success and login on-failure commands to generate a SYSLOG message. These commands were added as part of the Cisco IOS Login Enhancements.
These are the commands in the configuration:
c1kv-1# sh run | in ^login login on-failure log login on-success log
And these are the SYSLOG messages generated:
*Sep 6 16:32:56.188: %SEC_LOGIN-5-LOGIN_SUCCESS: Login Success [user: admin] [Source: 192.168.1.78] [localport: 22] at 16:32:56 UTC Sun Sep 6 2015 *Sep 6 16:33:21.346: %SYS-6-LOGOUT: User admin has exited tty session 1(192.168.1.78) *Sep 6 16:33:30.353: %SEC_LOGIN-4-LOGIN_FAILED: Login failed [user: admin] [Source: 192.168.1.78] [localport: 22] [Reason: Login Authentication Failed] at 16:13:30 UTC Sun Sep 6 2015
Regards
09-06-2015 05:52 AM
Thank you for your response.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide