linux关闭不必要的用户

#!/bin/bash
for user in $( cat /etc/passwd | grep -v root | cut -d ":" -f 1 )
do
str=(adm lp sync shutdown halt news uucp operator games gopher)
str=(adm lp news uucp games dip pppusers popusers slipusers)
for i in ${str[*]}
do
if [[ $i =~ $user ]]
then
#userdel -r $i
#锁定用户
usermod -L $i
#解锁
#usermod -U $i
#groupdel $i
break
fi
done
done

 

posted @ 2017-08-25 08:30  Downtime  阅读(348)  评论(0编辑  收藏  举报
TOP