说明:限制重复IP登录服务器的脚本。
描述:发现同一IP多个连接到服务器时踢掉多余连接(保留一个连接)。
时间:2011-10-18 10:53
作者:半点闲 郑州
提示:HP-UX系统下测试通过,其它系统有稍许差异请自行微调,非ROOT用户只能踢掉自身多IP登录的连接。
for i in `who -a|cut -c52-|grep '[0-9]\.'|sort|uniq -d`
do
for j in `who -a|grep $i|cut -c12-18`
do
echo "kill -9 `ps -e|grep $j|grep ksh|cut -c-7` 1 2>/dev/null">>list
done
done
chmod +x list 1 2>/dev/null
./list 1 2>/dev/null
rm -r list 1 2>/dev/null