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