Wednesday, December 19, 2012

Logout users forcefully

Q. How do I logout a Linux user?

A. root or admin user can logout any user forcefully. If you are logged in as david and just wanted to logout or logoff, type logout command or hit CTRL+D:
 
$ logout

You will be logged out of a login shell session or secure shell session.

Linux logout user

If you would like to logout other users, you must login as root user. Then use pkill command.

pkill command syntax

pkill -KILL -u {username}
To see list of logged in user type who or w command:
# who
OR

# w

To logout user called john, enter:
# pkill -KILL -u john

OR
$ sudo pkill -KILL -u john

No comments:

Post a Comment