Changing user passwords

This commit is contained in:
Bob Mottram 2015-12-23 13:39:00 +00:00
parent 71eee18bc3
commit d64d747e03
1 changed files with 17 additions and 6 deletions

View File

@ -40,6 +40,9 @@ ADMIN_USER=
UPGRADE_SCRIPT_NAME="${PROJECT_NAME}-upgrade"
UPDATE_DATE_SCRIPT=/usr/bin/updatedate
# Minimum number of characters in a password
MINIMUM_PASSWORD_LENGTH=8
USB_DRIVE=sdb
# get default USB from config file
CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
@ -196,12 +199,20 @@ function change_password {
if [ ! $SELECTED_USERNAME ]; then
return
fi
clear
echo -n $"Change password for"
echo " $SELECTED_USERNAME"
echo ""
su -c "passwd" - $SELECTED_USERNAME
any_key
dialog --title $"Change password" \
--passwordbox $"New password for user $SELECTED_USERNAME" 8 40 2> $data
newpassword=$(<$data)
if [ ${#newpassword} -lt ${MINIMUM_PASSWORD_LENGTH} ]; then
dialog --title $"Change password" \
--msgbox $"The password should be ${MINIMUM_PASSWORD_LENGTH} or more characters" 6 40
return
fi
echo "$SELECTED_USERNAME:$newpassword"|chpasswd
dialog --title $"Change password" \
--msgbox $"Password for $SELECTED_USERNAME was changed" 6 40
}
function irc_set_global_password {