Remove default password

This commit is contained in:
Serge Schneider 2022-03-18 15:03:23 +00:00
parent 5d044ba71b
commit 95ac3cfb3b
3 changed files with 7 additions and 4 deletions

View file

@ -179,9 +179,9 @@ The following environment variables are supported:
Username for the first user
* `FIRST_USER_PASS` (Default: "raspberry")
* `FIRST_USER_PASS` (Default: unset)
Password for the first user
Password for the first user. If unset, the account is locked.
* `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset)

View file

@ -224,7 +224,7 @@ export LOG_FILE="${WORK_DIR}/build.log"
export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry}
export FIRST_USER_PASS
export RELEASE=${RELEASE:-bullseye}
export WPA_ESSID
export WPA_PASSWORD

View file

@ -8,7 +8,10 @@ on_chroot << EOF
if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then
adduser --disabled-password --gecos "" ${FIRST_USER_NAME}
fi
echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd
if [ -n "${FIRST_USER_PASS}" ]; then
echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd
fi
echo "root:root" | chpasswd
EOF