1848566 Members
6142 Online
104033 Solutions
New Discussion

Re: Password Aging.

 
Peter Maitland
Occasional Advisor

Password Aging.

Is there a way that I can script a password expiration time and minimum time between changes? Here is the the situation; we have a user template with those parameters set but I hate having to go through sam everytime I have to set up a new user.

Is there a way I can script this? I was thinking of setting /etc/default/useradd to have the values I need and then just using useradd but I am nore sure of the values I need in useradd to achieve this.

This is a 10.20 untrusted system. Any help would be appreciated. Thanks.

Peter

2 REPLIES 2
Pedro Sousa
Honored Contributor

Re: Password Aging.

from the passwd man page:
-n min Determine the minimum number of days, min, that must transpire before the user can change the password.
-w warn Specify the number of days, warn, prior to the password expiring when the user will be notified that the password needs to be changed. This option is only enabled when the system has been converted to a trusted, secure system. Refer to the Managing Systems and Workgroups manual for how to convert your HP-UX to a trusted, secure system.
-x max Determine the maximum number of days, max, a password can remain unchanged. The user must enter another password after that number of days has transpired, known as the password expiration time.

the useradd just has the option to expire the login account, but not the password.

good luck.
A. Clay Stephenson
Acclaimed Contributor

Re: Password Aging.

Hi Peter:
You can't do it with just useradd but you're on the right track.
The sequence is as follows:
1)useradd (if you want to change anything from the defaults args, do so; you're not trusted so
no -f we will set -e in a moment)
2) passwd username
& enter his password
3) passwd -n min -x max username

The last command will set minumum time between passwd changes to min days (rounded to the week) and the maximum valid passwd age to max days (again rounded to the week).

If you are in an NIS environment you will have to use yppasswd(3) in a c program to do the equivalent and code a replacement for yppasswd(1).

This should get you started, Clay
If it ain't broke, I can fix that.