作者:javalee 要想让某些用户不能系统,可以用简单实现 可以先建立一个deny.user的,内容如下: user1 user2 user3 然后将下列代码加到 /etc/porfile里 logname=`whoami |grep '{print $1}'` while read i; do if [ $i =$logname ]; then echo "Sorry,$LOGNAME can not " && exit fi do < /path/deny.user
代码: #! /bin/ksh #scriptname:killuser #disabel some user login system #start... echo -n "who do you want to kill:" read username while true do kill -9 $(ps -aux|grep $username|awk '{print $2}') sleep 1 done