You can easily spot the idle user by looking at the IDLE column; the user in the first row has been idle for 3 days. There are many ways of killing idle users, but here I’ll show you my favorite one. The bottom line is, you need to kill the parent process created by the idle user when he logged in.

Looking at the output from the w command above, we can see that the idle users’ TTY is pts/1 so now all we need is the PID for the parent process. We can find that by running

who -all | grep root

Here we can see that 31472 is the PID for the parent process of pts/1, so once we issue kill -1 31472 that idle session will be gone!

About the author:
Marius Voila is a Linux Sysadmin, a photographer, a technologist, a specialist in deployments, cloud computing, load balancing, scaling and performance tuning, as well as developing disaster-recovery best practices such as backups and restorations, firewalls, and server security audits, OpenStack deployments. Read more →Follow @mariusvoila