CentOS如何强行踢掉某登录用户

发布于: 2019-08-08 15:54

Linux是一个多用户操作系统,用户可以在不同的地方链接上Linux服务器。

在系统中我们可以用w或者who来查看用户:

[[email protected] ~]# who
root pts/0 2019-04-17 20:45 (58.63.138.162)
root pts/1 2019-05-5 22:24 (118.186.197.221)


[[email protected] ~]# w
22:33:29 up 4 days, 8:05, 2 users, load average: 1.58, 1.36, 1.47
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
root pts/0 58.63.138.162 20:45 0.00s 0.03s 0.00s w
root pts/1 118.186.197.221 22:24 4:40 0.02s 0.02s -bash


看看那个是自己登录的用户:

[[email protected] ~]# who am i
root pts/0 2019-04-17 20:45 (58.63.138.162)


接下来使用 pkill 踢掉用户 pts/1:

[[email protected] ~]# pkill -kill -t pts/1


接着用w或者who查看:

[[email protected] ~]# w
22:40:43 up 4 days, 8:12, 1 user, load average: 1.58, 1.36, 1.40
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
root pts/0 58.63.138.162 20:45 0.00s 0.03s 0.00s w


已经没有 pts/1 了,大功告成。

原文链接:,转发请注明来源!

发表评论

要发表评论,您必须先登录