Change password script....
Our help desk group has a shared account and runs a menu on each system to perform their daily tasks, among those tasks is changing user account passwords.
I am trying to fix this account password change script that is part of the menu. Our help desk group runs this script below to change user passwords. But as of late, the script has not worked properly. When a user password is changed by the script, it appears to have worked. But if the same user attempts to log into the same system with the new password, they will get an access denied message. This has happened to Solaris 8, 9, and 10 systems. I have no idea on what has gone wrong. Can anyone help, please? Thanks in advance.
ECHO=/usr/bin/echo
BACKUPDIR=/admin/sys_backup
$ECHO "Enter USERNAME: "
read USERNAME
if [ "$USERNAME" = "" ]; then
$ECHO ""
$ECHO "*** SORRY: MUST ENTER A USERNAME!! ***"
$ECHO ""
/bin/sh $BACKUPDIR/not_change_root
fi
GROUPID="`grep $USERNAME /etc/passwd | cut -d: -f4 - `"
GROUPNAME="`grep ":$GROUPID:" /etc/group | cut -d: -f1 - `"
if [ "$USERNAME" = "root" ]; then
$ECHO ""
$ECHO "*** SORRY: CAN'T CHANGE THE ROOT PASSWORD!! ***"
$ECHO ""
/bin/sh $BACKUPDIR/not_change_root
fi
if [ "$GROUPNAME" = "csg" ]; then
$ECHO ""
$ECHO "*** SORRY: CAN'T CHANGE CSG MEMBER'S PASSWORD!! ***"
$ECHO ""
/bin/sh $BACKUPDIR/not_change_root
fi
/usr/local/bin/sudo /usr/bin/passwd $USERNAME
/usr/local/bin/sudo /usr/bin/passwd -f -x 90 -w 10 $USERNAME
$ECHO ""
$ECHO ""
$ECHO "Password for $USERNAME was SUCCESSFULLY changed."
$ECHO ""
$ECHO ""
sleep 2

