set user password with passwd, chpasswd does not work for some reason

This commit is contained in:
Sebastian Hugentobler 2021-02-08 19:01:57 +01:00
parent a2ad37d096
commit 4b93866392
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0

View File

@ -181,14 +181,14 @@ set_user() {
user_name="$(get_value "user_name" "username")" user_name="$(get_value "user_name" "username")"
local user_pw local user_pw
user_pw="$(get_value "user_pw" "user password")" user_pw="$(get_value "user_pw" "user password" 1)"
chroot /mnt /bin/env -i \ chroot /mnt /bin/env -i \
user_name="$user_name" \ user_name="$user_name" \
user_pw="$user_pw" \ user_pw="$user_pw" \
/bin/bash <<"EOT" /bin/bash <<"EOT"
useradd --groups wheel --create-home --shell /bin/bash --user-group $user_name useradd --groups wheel --create-home --shell /bin/bash --user-group $user_name
echo "$user_name:$user_pw" | chpasswd echo -e "$user_pw\n$user_pw" | passwd "$user_name"
EOT EOT
} }