平台: RHEL5.4
首先可用"w"命令查看登录用户信息, 然后使用"pkill -kill -t pts/x"命令踢用户(表示使用pkill发出kill信号踢出终端是pts/x的用户, 可以同时踢多个用户), 只有root用户才能踢人. 举例如下:
#
w
11:52:49 up 61 days, 21:22, 5 users, load average: 0.50, 0.49, 0.47
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
oracle pts/8 172.16.1.180 25Jul10 37days 0.08s 0.07s rlwrap -s 5000 /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus / as sysdba
oracle pts/10 172.16.1.180 25Jul10 37days 0.00s 0.00s screen -RS hehehehe
oracle pts/11 - 25Jul10 37days 0.03s 0.02s ssh 172.16.1.188
root pts/12 192.168.41.42 10:25 0.00s 0.04s 0.04s -bash
oracle pts/16 172.16.1.180 25Jul10 37days 0.02s 0.02s ssh 172.16.1.188
#
pkill -kill -t pts/8,pts/10,pts/11
#
w
11:53:14 up 61 days, 21:23, 2 users, load average: 0.46, 0.49, 0.46
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/12 192.168.41.42 10:25 0.00s 0.05s 0.05s -bash
oracle pts/16 172.16.1.180 25Jul10 37days 0.02s 0.02s ssh 172.16.1.188
#
pkill -kill -t pts/16
#
w
11:53:23 up 61 days, 21:23, 1 user, load average: 0.39, 0.47, 0.46
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/12 192.168.41.42 10:25 0.00s 0.05s 0.05s -bash
--End--
来自: http://hi.baidu.com/chijr/blog/item/38dba2260ebab0078a82a1ae.html