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_set/s50_initUserPath
#!/bin/sh

#=====================================================================
InsertSection "Set the ALWAYS_SET_PATH..."

if [ $SET_ALWAYS_SET_PATH -eq 1 ]; then

    cp -np /etc/login.defs /etc/login.defs_bak

    #-----------------set the ALWAYS_SET_PATH----------------
    IS_EXIST=`egrep -v '^#|^$' /etc/login.defs | grep 'ALWAYS_SET_PATH' | wc -l`
    if [ $IS_EXIST -eq 0 ] ; then
        echo -e "ALWAYS_SET_PATH=yes" >> /etc/login.defs
    else
	sed -i 's/^ALWAYS_SET_PATH.*/ALWAYS_SET_PATH=yes/' /etc/login.defs
    fi


    IS_EXIST=`egrep -v '^#|^$' /etc/login.defs | grep '^ALWAYS_SET_PATH' |wc -l`
    if [ $IS_EXIST -eq 0 ] ; then
      logtext "NO ALWAYS_SET_PATH set, setting failed"
      Display --indent 2 --text "- NO ALWAYS_SET_PATH set... " --result FAILED --color RED
    else
      if [ $(egrep -v '^#|^$' /etc/login.defs | grep '^ALWAYS_SET_PATH' | grep yes |wc -l) -eq 0 ];then
        logtext "Wrong ALWAYS_SET_PATH, seting failed"
        Display --indent 2 --text "- Wrong ALWAYS_SET_PATH... " --result FAILED --color RED
      else
        logtext "Has ALWAYS_SET_PATH set, seting ok"
        Display --indent 2 --text "- Set ALWAYS_SET_PATH... " --result FINISHED --color GREEN
      fi
    fi


else
    Display --indent 2 --text "- Skip set ALWAYS_SET_PATH due to config file... " --result SKIPPING --color YELLOW
fi