主頁 > 知識庫 > linux系統(tǒng)中的列出敏感用戶的腳本代碼

linux系統(tǒng)中的列出敏感用戶的腳本代碼

熱門標簽:Linux服務器 AI電銷 服務外包 呼叫中心市場需求 網(wǎng)站排名優(yōu)化 地方門戶網(wǎng)站 鐵路電話系統(tǒng) 百度競價排名

此處的敏感用戶是指這個用戶屬于多個組,或者這個用戶屬于的組名跟這個用戶名不一樣

#! /bin/bash 
#list user who belong to more than one group 
#and list user who belong to the group which isn't the same as the username 
#w is whitelist,we will not think user in this whitelist is special or dangerous w=("root" "adm" "games" "operator" "halt" "shutdown" "sync" "daemon" "bin" "operator") function WhiteList() 
{ 
    for i in ${w[@]} 
    do
        if [ "$i" == "$1" ];then
            return 1 
        fi
    done
    return 0 
} 
IFS=" 
" for LINE in `cat /etc/passwd|awk -F: '{print $1}'` do
    WhiteList $LINE; 
    #if $? equal 1,means it is in the whitelist     if [ $? -eq 0 ];then
        a=`groups $LINE|awk -F: '{print $2}'` 
        b=`echo $a` 
        if [ "$b" != "$LINE" ];then
            #echo $LINE             echo `groups $LINE` 
        fi
    fi done

標簽:崇左 湖南 銅川 湘潭 仙桃 蘭州 衡水 黃山

巨人網(wǎng)絡通訊聲明:本文標題《linux系統(tǒng)中的列出敏感用戶的腳本代碼》,本文關鍵詞  ;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266