1.首先看一下当前有哪些用户在服务器中,用who 命令也行, w 命令显示的信息更全一些[code][root@Scpman ~]# w
13:12:29 up 1:46, 5 users, load average: 0.18, 0.16, 0.23
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty3 - 12:10 53:04 0.07s 0.07s -bash
root tty1 :0 11:27 1:46m 5:25 5:25 /usr/bin/Xorg :
root pts/0 :0.0 12:34 21:40 0.12s 0.07s man scp
root pts/2 :0.0 12:54 0.00s 0.05s 0.00s w
xxx pts/3 192.168.99.7 13:12 23.00s 0.01s 0.01s -bash //这个人,人品不好,我不想让他在里面玩了[/code] [code][root@Scpman ~]# ps -aux | grep pts/3 //注意看好这个哦,不要搞错了,用ps -aux 显示进程,然后用grep 筛选对我们有用的信息
Warning: bad syntax, perhaps a bogus ‘-’? See /usr/share/doc/procps-3.2.8/FAQ
xxx 4890 0.0 0.0 108796 1704 ? S 13:12 0:00 sshd: xxx@pts/3 // t第一条
xxx 4891 0.0 0.0 110564 1856 pts/3 Ss+ 13:12 0:00 -bash //第二条
root 4943 0.0 0.0 103392 820 pts/2 S+ 13:12 0:00 grep –color=auto pts/3[/code] [code][root@Scpman ~]# kill 4890 //注意在上面的时候有两条,一般杀掉数字小的进程。4890小于4891[/code]
好了,再看一下当前有谁在系统里[code][root@Scpman ~]# w
13:23:22 up 1:57, 4 users, load average: 0.36, 0.23, 0.23
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty3 - 12:10 1:03m 0.07s 0.07s -bash
root tty1 :0 11:27 1:57m 5:56 5:56 /usr/bin/Xorg :
root pts/0 :0.0 12:34 32:33 0.12s 0.07s man scp
root pts/2 :0.0 12:54 0.00s 0.07s 0.00s w
[root@Scpman ~]#[/code]