Merge pull request #89 from tyzhnenko/issue88_grant_sudo_to_gerular_user

Add GRANT_SUDO parameter to context
pull/100/head
Vlastimil Holer 7 years ago committed by GitHub
commit 24233b1b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,6 +24,13 @@ if ! getent passwd "${USERNAME}" > /dev/null 2>&1; then
useradd -m "${USERNAME}"
fi
if [ "${GRANT_SUDO}" == "YES" -a "${USERNAME}" != "root" ]; then
if [ ! -f /etc/sudoers.d/${USERNAME} ]; then
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME}
chmod 644 /etc/sudoers.d/${USERNAME}
fi
fi
if [ -n "${CRYPTED_PASSWORD_BASE64}" ]; then
CRYPTED_PASSWORD=$(echo $CRYPTED_PASSWORD_BASE64 | base64 -d)
usermod -p "${CRYPTED_PASSWORD}" "${USERNAME}"

Loading…
Cancel
Save