Forcing users to change password at login - Probably "Again"
Ben Kevan
ben.kevan at gmail.com
Mon Jul 14 22:01:25 UTC 2008
On Monday 14 July 2008 02:24:18 pm Hari N wrote:
> Ben,
>
> After the line in your script where you create a new user, you could try
> adding a line that will change the third field in /etc/shadow for that new
> user and make that value zero. Basically passwd -f command does the same.
> If this value is set to zero, it should prompt the user to change his
> password when he logs in next time.
>
> Regards,
> Hari
>
Hi Hari,
Wanted a nice easy solution that didn't need the modification of /etc/shadow
via a script (but doesn't seem like that is a choice)... I used what seems to
be the only solution (changing modifying /etc/shadow).. Here it is if anyone
cares to use:
egrep -v "^$ACCT:" < /etc/shadow > /tmp/shadow.tmp
egrep "^$ACCT:" /etc/shadow | \
awk -F: '{print $1 ":" $2 ":0:" $4 ":" $5 ":"
$6 ":" $7 ":" $8 ":" $9}' >> /tmp/shadow.tmp
mv /tmp/shadow.tmp /etc/shadow
I may create a script to call, to lock and unlock the shadow file while it's
being modified by the script.. Damn I wish -e would be implemented into
RHEL..
Does anyone know why it wasn't?
More information about the redhat-list
mailing list