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/option_check/c25_addUser
#!/bin/sh

#=====================================================================
InsertSection "Check whether have the customer user"

############### default value #################
#  UserName=wangguan                          #
#  UserPass=xxxxxxxx                          #
############### default value #################

if [[ ! -z $UserName ]];then
    for i in `cat /etc/passwd |awk -F ':' '{print $3 ":" $1}' | sort -n -r | cut -d ':' -f 2`
    do
        if [[ ${UserName} = $i ]];then
            count_user=`expr ${count_user} + 1`
        fi
    done
    if [[ $count_user -gt 0 ]];then
        logtext "already have ${UserName}, no need to add"
        Display --indent 2 --text "- Already have user:${UserName}..." --result OK --color GREEN
        AddHP 1 1
    else
        echo "c25" >> $RESULT_FILE
        echo "" >> $RESULT_FILE
        logtext "WRN_C25: $(loadtext TXT_WRN_C25)"
        logtext "Suggestion: $(loadtext TXT_SUG_C25)"
        Display --indent 2 --text "- Check whether have additional user... " --result WARNING --color RED
        Display --indent 2 --text "No additional user found, check warning"
        AddHP 0 1
    fi
else
    logtext "No valid userName found, please check config file..."
    Display --indent 2 --text "- No valid userName found, please check config file..." --result FAILED --color RED
fi