ctf线下赛中关闭非法用户shell脚本

linux中三类用户:根用户,虚拟用户,普通用户。

其中普通用户的UID一般介于500-6000之间。

#!/bin/bash
for uid in $( cat /etc/passwd | cut -d ":" -f3 )
do
if [[ $uid -gt 500 && $uid -lt 6000 ]]
then
user=$(cat /etc/passwd | grep "$uid" | cut -d ":" -f1)
echo "$user $uid"
#usermod -L $user
#usermod -U $user
#passwd -l/u $user
fi
done

 

 



 

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