How To Check Currently Logged-In User In Linux System
As System Admin, you need to know who’s logged-in on the system and what they’re doing here. Let’s see how to check currently logged-in user and after making this little security, we can keep an eye on what commands user are running on the server.
This is very important to find out who’s logged-in without authorisation on the server. you can use monitoring tools to keep an eye on all the infrastructure.
w command is used to show logged-in user and what they’re doing on the systems. there’re many arguments available with ‘w’ command. This information written in /var/log/utmp
Last command will print the successful entries from the past attempts made by user and last reads from a log file /var/log/wtmp.
You can also use ‘stat‘ command to check when timestamp of the file,
who -a command will show you who’s logged-in on the systems.
You can also use users, who and whoami commands.
YouTube Link :