How to kill and logout a user in Linux

You can check who is logged in to a Linux system by executing

who or w commands

and then you can get the user PID

ps aux | grep username or tty

and kill it

kill -KILL PID

or you can use pkill command and kill the user by its username

pkill -KILL -u username

It would be nice to send the users a warning message before logging them out.

Leave a Reply

Your email address will not be published. Required fields are marked *