如何剔除linux在线用户

来源:互联网 发布:python 连接mongodb 编辑:程序博客网 时间:2024/05/02 01:23

(1)查询当前登录用户
[root@firewall ~]# finger
Login     Name       Tty      Idle Login Time   Office     Office Phone
root      root       pts/0          May 4 23:19 (172.16.7.29)

(2)查询某个登录用户的所有进程
[root@firewall ~]# ps -ef | grep pts/0
root      3140 2070 0 23:19 ?        00:00:00 sshd: root@pts/0
root      3142 3140 0 23:19 pts/0    00:00:00 -bash
root      3195 3142 0 23:24 pts/0    00:00:00 ps -ef
root      3196 3142 0 23:24 pts/0    00:00:00 grep pts/0
(3)干掉登录用户Shell 进程

kill -9 3142

原创粉丝点击