Linux强制下线指定用户

[root@localhost ~]# w
#使用 w 命令查看当前所有远程连接此机器的用户
 17:02:56 up  3:01,  3 users,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1                      14:01   56.00s  1.33s  0.00s -bash
root     pts/0    192.168.211.2    17:02    0.00s  0.02s  0.00s w
root     pts/1    192.168.211.2    17:02    8.00s  0.02s  0.02s -bash

[root@localhost ~]# whoami
root
#查看自己的用户号
[root@localhost ~]# who am i
root     pts/0        2020-09-16 17:02 (192.168.211.2)

[root@localhost ~]# pkill -kill -t pts/1
#强制下线 pts/1 的这个用户
[root@localhost ~]# w
#查看是否成功
 17:06:02 up  3:04,  2 users,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1                      14:01    1:46   1.76s  0.43s -bash
root     pts/0    192.168.211.2    17:02    2.00s  0.05s  0.02s w

[root@localhost ~]# 

 

posted @ 2020-09-17 12:18  Security  阅读(362)  评论(0编辑  收藏  举报
小布的个人空间 京ICP备2023021324号-1