31 January 2011

How can root forcefully logout a user?

First, determine the process id (PID) of the shell they are using to login.

Code:
ps aux | grep user
Look for the entry for the login shell. If they are using bash, it will be the line where the last column is -bash. The number in the second column is the PID.
To kill the login shell, type the following:
Code:
kill PID
This should stop the user's login session. I'm not sure if this will also stop any other processes of that user, but if not, you can just use the first command again to find any other processes for the user and kill them.

OR -

Use the who command to see list of logged in users and sudo pkill -KILL -u username to log out user.

No comments:

Post a Comment