If you need to gather information on user logins for your Linux servers, Jack Wallen has just the tool for you.
Linux is an incredibly powerful platform that allows you to do just about anything you might want or need. As an admin, that’s a double-edged sword–especially given Linux is a multi-user environment. In other words, more than one user can be logged in at once.
That means admins might find themselves having to track down more information about those logins than they’re accustomed to. For example, what users are logged in, what groups do they belong to, and what have they been doing? Where do you get such information? Have there been failed login attempts?
SEE: Linux file and directory management commands (TechRepublic Premium)
Fortunately, there’s a built-in tool that makes gathering details about a user fairly simple. Log in to your Linux server or desktop and issue the command:
This tool will display information about known users on a system. When running the command without options, it’ll spit out more listings (for both regular and system users) than you need. So let’s make it a bit more helpful.
First, issue the command:
This will ignore system users and list UID, username, the number of processes associated with the user, the last login, and the GECOS entry in the password file.
To get even more information, run the command on a single user, as in:
By issuing the command against a single username, you’ll get extra details like groups, last terminal, and last logs for the user. This is quite helpful, as it gives you insight into what a particular user might have done on the system.
Finally, you can check for failed sudo logins with the command:
sudo lslogins -uf
If a user has attempted and failed a login, you’ll know about it.
If you’re a Linux systems admin, you need to get the lslogins command in your toolkit immediately. Find out more on how lslogins is used by issuing the command:
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.
This post was written by and was first posted to TechRepublic
Do you find this article helpful? Your Friend might too. So, please Share it with them using the Share button above.
Will you like to get notified when I post new updates? Then Follow me on any of my social media handles: Google News, Telegram, WhatsApp, Twitter, Facebook, Pinterest.
You can also drop your email address below if you wish to be notified by mail.