Ideally, passwords should be changed regularly. This article describes how to setup password expiration using the User Manager application in Red Hat Enterprise Linux 5 or CentOS 5.

1. Click Applications then select System Settings and click Users and Groups. This will launch the User Manager window.

4. Check the Enable Password Expiration checkbox to enable password expiration. The list below describes the available settings.
- Days before change allowed
Number of days from the last password change to allow another password change. - Days before change required
Number of days from the last password change to require another password change. - Days warning before change
Number of days before the expiry of the password to notify the user. - Days before account inactive
Number of inactive days after the expiry of the password to deactivate the account. 0 means do not deactivate.
You can also do this from the command line, below are the equivalent commands.
- chage login_name
modifies the password expiry information of the specified login name. You need root access to use this command. - chage -l login_name
shows the password expiry information of the specified login name - chage
displays the help information
You can notify the users with expiring password via email using the checkpwexpire script. Copy the script into the /etc/cron.daily and give it execute permission so it will automatically run every day.Visit the forum to ask for help or to give a comment.
***
Posted on 8/5/2009 and last updated on 11/6/2009
Filed under CentOS 5 , Red Hat Enterprise Linux 5 , System Administration


August 8th, 2009 at 12:29 am
Hi,
I have Password Expiration set up with my CentOS 4 network and it works fine. But my CentOS 5 machines refuse to pop up a Warning message at desktop login, unlike my C4 ones.
Any ideas?
Thanks,
Steve
August 9th, 2009 at 7:33 pm
Hi Steve,
It’s a bug. If you really need the pop up warning, you can use the plain login screen. Go to System > Administration > Login Screen to configure the login screen.
August 17th, 2009 at 12:56 pm
hi,
When running this script i’m getting this error
Number found where operator expected at -e line 2, near “14367″
(Missing semicolon on previous line?)
syntax error at -e line 2, near “14367″
Execution of -e aborted due to compilation errors.
/tmp/checkpwexpire: line 145: [: -107
14366: integer expression expected
Please Help
August 17th, 2009 at 7:46 pm
Hi Anshul,
What OS are you using?
August 17th, 2009 at 9:17 pm
hi,
I’m using CentOS 4.7
August 19th, 2009 at 9:31 pm
Hi Anshul,
I’ve updated the script. Please try it again.