linux系统中的列出敏感用户的脚本代码
此处的敏感用户是指这个用户属于多个组,或者这个用户属于的组名跟这个用户名不一样
#!/bin/bash
#listuserwhobelongtomorethanonegroup
#andlistuserwhobelongtothegroupwhichisn'tthesameastheusername
#wiswhitelist,wewillnotthinkuserinthiswhitelistisspecialordangerousw=("root""adm""games""operator""halt""shutdown""sync""daemon""bin""operator")functionWhiteList()
{
foriin${w[@]}
do
if["$i"=="$1"];then
return1
fi
done
return0
}
IFS="
"forLINEin`cat/etc/passwd|awk-F:'{print$1}'`do
WhiteList$LINE;
#if$?equal1,meansitisinthewhitelistif[$?-eq0];then
a=`groups$LINE|awk-F:'{print$2}'`
b=`echo$a`
if["$b"!="$LINE"];then
#echo$LINEecho`groups$LINE`
fi
fidone热门推荐
10 感谢韩语老师祝福语简短
11 升职文案高级祝福语简短
12 花童结婚祝福语大全简短
13 向国庆送祝福语简短
14 什么寄语简短祝福语女生
15 客户回礼祝福语大全简短
16 女孩生日祝福语简短创意
17 家长回复节日祝福语简短
18 给外婆敬酒祝福语简短