14383 shaares
5331 private links
5331 private links
Find a List of Logged In Users
You can use the "who" command to find a list of users currently logged into the system. Using the -u (--users) option will also display the PID (process ID) of the users shell session.
End the Users Shell Process
When you are ready to kick the user, send the SIGHUP to the users shell process. A SIGHUP signal is the same signal the process would receive when the controlling terminal is closed.
sudo kill -HUP 9940
The number at the end of the above command is the process ID of the users shell. We found the process ID using the who command above.
Sometimes there is a process that hangs. In that case we can send a SIGKILL (kill -9) to the PID. This is exactly what it sounds like. It will immediately terminate ANY process, so be careful.
sudo kill -9 9940