diff options
author | Eric Hameleers <alien@slackware.com> | 2021-09-08 14:31:08 +0200 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2021-09-08 14:31:08 +0200 |
commit | eefaaecddd26080e88dbb0cbabdd4b8e7d5a9351 (patch) | |
tree | c77c85426d0c6e0f4c2eeb1b99586a4dfcafc49a /liveinit.tpl | |
parent | efc7fce096dd16314dea502f750040b3b4cea6a3 (diff) | |
download | liveslak-eefaaecddd26080e88dbb0cbabdd4b8e7d5a9351.tar.gz liveslak-eefaaecddd26080e88dbb0cbabdd4b8e7d5a9351.tar.xz |
Allow for empty password for the live and root accounts
Diffstat (limited to 'liveinit.tpl')
-rw-r--r-- | liveinit.tpl | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/liveinit.tpl b/liveinit.tpl index 1eaba1d..e25bf9b 100644 --- a/liveinit.tpl +++ b/liveinit.tpl @@ -106,6 +106,11 @@ HNMAC_ALLOWED="YES" INTERFACE="" NFSHOST="" +# Password handling, assign random initialization: +DEFPW="7af0aed2-d900-4ed8-89f0" +ROOTPW=$DEFPW +LIVEPW=$DEFPW + # Max wait time for DHCP client to configure an interface: DHCPWAIT=20 @@ -1162,20 +1167,28 @@ EOT fi fi - if [ ! -z "$LIVEPW" ]; then + if [ -n "$LIVEPW" ] && [ "$LIVEPW" != "${DEFPW}" ]; then # User entered a custom live password on the boot commandline: echo "${MARKER}: Changing password for user '${LIVEUID}'." chroot /mnt/overlay /usr/sbin/chpasswd <<EOPW ${LIVEUID}:${LIVEPW} EOPW + elif [ -z "$LIVEPW" ]; then + # User requested an empty live password: + echo "${MARKER}: Removing password for user '${LIVEUID}'." + chroot /mnt/overlay /usr/bin/passwd -d ${LIVEUID} fi - if [ ! -z "$ROOTPW" ]; then + if [ -n "$ROOTPW" ] && [ "$ROOTPW" != "${DEFPW}" ]; then # User entered a custom root password on the boot commandline: echo "${MARKER}: Changing password for user 'root'." chroot /mnt/overlay /usr/sbin/chpasswd <<EOPW root:${ROOTPW} EOPW + elif [ -z "$ROOTPW" ]; then + # User requested an empty root password: + echo "${MARKER}: Removing password for user 'root'." + chroot /mnt/overlay /usr/bin/passwd -d root fi if [ ! -z "$HNMAC" -a "$HNMAC_ALLOWED" = "YES" ]; then |