armbian-firstlogin: allow empty user password (#5738)

Call the 'passwd' command with the right arguments depending on whether
the user entered a password or not.
This commit is contained in:
marcone 2023-09-23 19:14:10 -07:00 committed by GitHub
parent ad25ef919d
commit dd5fb3e3f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -282,7 +282,11 @@ add_user()
read -r -e -p "Please provide your real name: " -i "${RealUserName^}" RealName
adduser --quiet --disabled-password --home /home/"$RealUserName" --gecos "$RealName" "$RealUserName"
(echo "$first_input";echo "$second_input";) | passwd "$RealUserName" >/dev/null 2>&1
if [[ -n "$first_input" ]]; then
(echo "$first_input";echo "$second_input";) | passwd "$RealUserName" >/dev/null 2>&1
else
passwd -d "$RealUserName" >/dev/null 2>&1
fi
for additionalgroup in sudo netdev audio video disk tty users games dialout plugdev input bluetooth systemd-journal ssh; do
usermod -aG "${additionalgroup}" "${RealUserName}" 2>/dev/null
done