On Thu, 2003-06-12 at 04:42, Kwan Lowe wrote:
> On Wed, 2003-06-11 at 11:30, Mark wrote:
>
> >
> > if [ "$USERID" -gt "499" ] && [ "$USERNAME" != "nobody" ] ; then
> > echo groupadd -g ${GROUPID} ${USERNAME}
> > echo useradd -u ${USERID} -g ${GROUPID} -c \"${COMMENT}\" \
> > -d ${USERDIR} -s ${USERSHL} ${USERNAME}
> > PASSWD=`grep ${USERNAME}: /etc/shadow | cut -d: -f2`
> > echo usermod -p \"$PASSWD\" ${USERNAME}
> > fi
> > done
>
> It looks like your setting the password to the hash.. Unless you
> replace the new shadow with entries from the old this won't work.
Using the "usermod -p <passwd>" it will pass the already hashed or md5
encrypted straight to the new /etc/shadow file, that's not the problem
with the script.. it's the accuracy of the line
PASSWD=`grep ${USERNAME}: /etc/shadow | cut -d: -f2`
(I might have to use a awk line or something here)
and the other problem is that bash scripts often interpret the "$"
symbols from the already md5 passwords out of the old /etc/shadow file,
not sure if that is the case here, as I haven't totally tested the
script.
Cheers
Mark
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com