gh-102: Optional password reset

Fixes #102
5.4.2
Vlastimil Holer 7 years ago
parent ccfe4c45f8
commit 7dc0e7cff4
No known key found for this signature in database
GPG Key ID: EB549BADEFD07C53

@ -27,6 +27,9 @@ fi
GRANT_SUDO=${GRANT_SUDO:-YES} GRANT_SUDO=${GRANT_SUDO:-YES}
GRANT_SUDO=$(echo "${GRANT_SUDO}" | tr '[:lower:]' '[:upper:]') GRANT_SUDO=$(echo "${GRANT_SUDO}" | tr '[:lower:]' '[:upper:]')
PASSWORD_RESET=${PASSWORD_RESET:-YES}
PASSWORD_RESET=$(echo "${PASSWORD_RESET}" | tr '[:lower:]' '[:upper:]')
if [ "${GRANT_SUDO}" == "YES" ] && [ "${USERNAME}" != "root" ]; then if [ "${GRANT_SUDO}" == "YES" ] && [ "${USERNAME}" != "root" ]; then
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/one-context echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/one-context
chmod 0440 /etc/sudoers.d/one-context chmod 0440 /etc/sudoers.d/one-context
@ -58,6 +61,6 @@ ${PASSWORD}
${PASSWORD} ${PASSWORD}
EOF EOF
fi fi
else elif [ "${PASSWORD_RESET}" = 'YES' ]; then
usermod -p '*' "${USERNAME}" usermod -p '*' "${USERNAME}"
fi fi

Loading…
Cancel
Save