@@ -678,6 +678,7 @@ The `USERS` and `USER_<username>` variable works similar to the `GROUPS` and `GR
- `system` - `useradd` will be called with `--system`.
- `allow-empty-password` - Even if the `password` flag is empty, it will still be set. This results in a login without password.
- `clear-text-password` - The `password` flag of the given user contains a clear-text password and not an encrypted version of it.
+ - `force-passwd-change` - Force the user to change to password on first login.
#### Home directory contents prefilling
@@ -17,7 +17,7 @@ USERS ??= ""
#USER_root[home] = "/home/root"
#USER_root[shell] = "/bin/sh"
#USER_root[groups] = "audio video"
-#USER_root[flags] = "no-create-home create-home system allow-empty-password clear-text-password"
+#USER_root[flags] = "no-create-home create-home system allow-empty-password clear-text-password force-passwd-change"
GROUPS ??= ""
@@ -258,5 +258,10 @@ image_configure_accounts() {
printf '%s:%s' "$name" "$password" | sudo chroot '${ROOTFSDIR}' \
/usr/sbin/chpasswd $chpasswd_args
fi
+ if [ "${flags}" != "${flags%*,force-passwd-change,*}" ]; then
+ echo "Execute passwd to force password change on first boot for \"$name\""
+ sudo -E chroot '${ROOTFSDIR}' \
+ /usr/bin/passwd --expire "$name"
+ fi
done
}