Forcing users to change password at login - Probably "Again"

Ben Kevan ben.kevan at gmail.com
Mon Jul 14 17:48:45 UTC 2008


Hi, 

I am writing this because I need to know how to force a password to be changed 
at next login via a useradd script. 

I originally wrote my script on an openSUSE box, which had the passwd -e 
argument, however RHEL4 (haven't checked RHEL5) does not have this argument 
avaliable. 

In the script I have also tried: 

passwd -f $ACCT (the acct variable is obviously the account name), but that 
makes me change the default created password at that time and not when the 
user logs in the next time

another method I tried was: 
chage -d 0 $ACCT (again this method let me su $ACCT) without having to change 
the password at all.. (this is not the behavior I want). 

So.. Is there a method I can use that allows what I want? Here is the user add 
portion of my script: 

useradd  -u $UUID -g $GID -c "$COMNT" -d $HDIR -s $USHELL $ACCT -p $pass && 
passwd -e $ACCT

The above works in SuSE but not in RHEL due to the lack of -e argument for 
useradd. 

All and any help is very greatful. Thank you




More information about the redhat-list mailing list