CentOS 7 把已登录的用户断开
1. 查看登陆用户
[root@localhost ~]# w
18:29:30 up 377 days, 8:44, 4 users, load average: 0.05, 0.12, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.25.127 182月21 12:10 0.21s 0.21s -bash
root pts/2 118.112.56.118 16:50 1:39m 0.01s 0.01s -bash
root pts/3 118.112.56.118 18:01 27:39 0.01s 0.01s -bash
root pts/4 192.168.25.127 18:26 2.00s 0.04s 0.02s w
2. 登出已登录用户
[root@localhost ~]# pkill -kill -t pts/0
3. 查看用户是否被登出
[root@localhost ~]# w
18:29:51 up 377 days, 8:45, 3 users, load average: 0.04, 0.11, 0.08
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/2 118.112.56.118 16:50 1:39m 0.01s 0.01s -bash
root pts/3 118.112.56.118 18:01 28:00 0.01s 0.01s -bash
root pts/4 192.168.25.127 18:26 7.00s 0.03s 0.00s w