diff --git a/bin/create_user.sh b/bin/create_user.sh index 789e9a7..d4456e1 100755 --- a/bin/create_user.sh +++ b/bin/create_user.sh @@ -88,9 +88,11 @@ if [ ! -d "${HOME_FOLDER}" ]; then error=1; fi; # allow 10 to 39 length for password -if ! [[ "${PASSWORD_LENGTH}" =~ ^[13][0-9]$ ]] || [ -z ${PASSWORD_LENGTH} ]; then +if ! [[ "${PASSWORD_LENGTH}" =~ ^[13][0-9]$ ]]; then echo "Password length set error, can only be a value between 10 and 39"; error=1; +elif [ -z ${PASSWORD_LENGTH} ]; then + PASSWORD_LENGTH=14; fi; error=1; # home dir error abort @@ -315,7 +317,7 @@ while read i; do # Note we only create a password if we need it # password + store pwgen 10 1 -1 if [ -z "${_password}" ]; then - password=$(printf "%s" $(pwgen 14 1)); + password=$(printf "%s" $(pwgen ${PASSWORD_LENGTH} 1)); elif [ "${_password}" = "SET_NO_PASSWORD" ]; then # set empty echo "* No password set";