Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Where and how exactly I can set the expiration time of password of users i.e.the time after which the UNIX OS prompts user after giving some warnings that your password will expire with in n days and then expire the user's password?

share|improve this question

migrated from stackoverflow.com Nov 5 '09 at 11:50

This question came from our site for professional and enthusiast programmers.

    
What flavor of Unix? –  kmarsh Nov 5 '09 at 12:55
add comment

3 Answers 3

up vote 1 down vote accepted

But you need to use the passwd command with the maxdays and warndays set:

e.g. passwd --maxdays 10 --warndays 5 user

would set the maxdays between password changes as 10, and give 5 days warning.

EDIT: So if you have a list of usernames in a text file one per line then the following might work:

cat usernamelist | while read $a; do passwd --maxdays 10 --warndays 5 $a; done
share|improve this answer
1  
This work well if I am the user, what if I need to do it for all users and I am not the uder but the admin. –  Sachin Chourasiya Nov 5 '09 at 10:48
    
No, this will only work if you are root. –  RobS Nov 5 '09 at 11:29
add comment

It is not part of the Unix standard, and is completely different depending on what OS you are using, and if you are using some sort of directory service. If you want to know you need to specify what OS you are using, and if it is Linux you probably need to specify what distro.

share|improve this answer
    
Louis, I am using linux,and I need to configure such setting that the passwords for all users will expire after a definite time. –  Sachin Chourasiya Nov 5 '09 at 10:23
    
@Sachin, Louis asked that you state what distro you're using. From what I understand this feature is not a standard on UNIX/Linux systems but may be available on some Linux distro. So let us know which one you're using. –  Helen Nov 5 '09 at 10:49
    
@Helen, I knew this is not a part of standard , but this is some what I need to conmfigure so as to achieve the automatic password expiration facility and thus to ensure the security. –  Sachin Chourasiya Nov 5 '09 at 11:13
    
can you please list your distro -- preferably the output of cat /etc/issue –  phoenix8 Nov 5 '09 at 12:04
add comment

Maybe you want to take a look at the chage command.

chage -l john



Last password change                                    : May 22, 2007
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
share|improve this answer
    
chage is not working on ksh man chage No manual entry for chage –  Sachin Chourasiya Nov 5 '09 at 11:43
    
Yes, sorry. I just know it from Debian. –  wishi Nov 5 '09 at 13:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.