fix not applied sudo password hash value

This commit is contained in:
leey0818
2022-10-20 00:19:34 +09:00
parent 2d0ebfad3b
commit 3b78eb20ef
2 changed files with 2 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then
fi
if [ -n "${SUDO_PASSWORD_HASH}" ]; then
echo "setting sudo password using sudo password hash"
sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
echo -e "abc:${SUDO_PASSWORD_HASH}" | chpasswd -e
else
echo "setting sudo password using SUDO_PASSWORD env var"
echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc