Howto: Kill or logout user forcefully by command in linux

Posted on Updated on

Command that helps to eject user form activity.

[root@server21 ~]# w
 06:48:27 up 8 days,  7:59,  2 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
anand     pts/0    192.168.0.152    06:48    0.00s  0.02s  0.00s w
root     pts/1    192.168.0.21     06:34   33.00s  0.06s  0.02s -bash

Logout user

[root@server21 ~]# skill -KILL -v pts/0

Now you may see one user logged in.

[root@server21 ~]# w
 06:48:57 up 8 days,  7:59,  1 user,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/1    192.168.0.21     06:34    0.00s  0.06s  0.00s w

You may also use the below scenarios.

#Kill by username 
[root@server21 ~]# skill -KILL -u anand

#Stop user
[root@server21 ~]# skill -STOP -u anand

#Resume user
[root@server21 ~]#skill -CONT -u anand
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s