Linux logout all other users
If you would like to logout other users, you must login as root user. Next you need to use the pkill command.
pkill command syntax
The syntax is:
pkill -KILL -u {username}
Warning: Do not kill root user or other system level user process. The following example, will kill all process on your server. Do not run the pkill for root user:
pkill -KILL -u root
To see list of logged in user type who or w command:
# who
OR
# w
To logout a user called raj, enter:
# pkill -KILL -u raj
OR
$ sudo pkill -KILL -u raj