HEX
Server: nginx/1.16.1
System: Linux ecs-04358622 4.19.90-2107.6.0.0100.oe1.bclinux.x86_64 #1 SMP Wed Dec 1 19:59:44 CST 2021 x86_64
User: nginx (994)
PHP: 8.0.0
Disabled: NONE
Upload Files
File: //opt/BCLinux/bse/secure_check/c16_lockUnUsedUser
#!/bin/sh

#=======================================================
InsertSection "check the unused user"

UnUsed="adm lp sync shutdown halt news uucp operator games nobody rpm smmsp"
ERROR_USER=""
COUNTER="0"
for i in $UnUsed
do
    IS_EXIST=`cat /etc/shadow |grep -i "^${i}" | wc -l`
    if [ $IS_EXIST -gt 0 ];then
        TMP=`cat /etc/shadow |grep -i "^${i}:\!" | wc -l `
        if [ $TMP -eq 0 ];then
            ERROR_USER="${ERROR_USER}|"$i
            COUNTER=`expr ${COUNTER} + 1`
        fi
    fi
done

if [ ${COUNTER} -gt 0 ];then
    echo "c16" >> $RESULT_FILE
    echo "" >> $RESULT_FILE
    logtext "WRN_C16: These users:${ERROR_USER} should lock"
    logtext "Suggestion: $(loadtext TXT_SUG_C16)"
    Display --indent 2 --text "- Check if there have unused user... " --result WARNING --color RED
    AddHP 0 1
else
    logtext "All unused user is locked, checking ok"
    Display --indent 2 --text "- Check if there have unused user... " --result OK --color GREEN
    AddHP 1 1
fi