LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-06-2009, 12:55 PM   #1
Linuxwho?
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Rep: Reputation: 0
How do I set a user password to expire on a specific date?


CMD line. Using Red Hat Ent Linux 5. Thanks in advance.
 
Old 07-06-2009, 01:00 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,487

Rep: Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882
ty the -e switch

from man useradd
Code:
-e, --expiredate EXPIRE_DATE
           The date on which the user account will be disabled. The date is specified in the format YYYY-MM-DD.

           If not specified, useradd will use the default expiry date specified by the EXPIRE variable in /etc/default/useradd, or an empty string (no expiry) by default.
 
Old 07-06-2009, 01:04 PM   #3
sonnik
Member
 
Registered: May 2001
Posts: 149

Rep: Reputation: 17
If the account already exists, try some of the passwd options...

Code:
man passwd
For example, you can run a cron job that runs (under root privs) "passwd -l username"...

This will lock until you (root) either deletes it or unlocks it. I'm assuming you want to lock the credentials out altogether on a set date.
 
Old 07-06-2009, 01:22 PM   #4
Linuxwho?
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for your answer but seems incorrect....

1. I looked there already and my man page states "E" not "e" but that's weird:

-E, --expiredate EXPIRE_DATE
Set the date or number of days since January 1, 1970 on which the userÔs account will no longer be
accessible. The date may also be expressed in the format YYYY-MM-DD (or the format more commonly used in your area). A user whose account is locked must contact the system administrator before being ble
to use the system again.

2. I am not looking to expire the account. That command expires the account on a date not the password. I am trying to simply set the password expiration date. For example, if I set the -E it will only change the expiry date not the password expire date. See below:

"[root@101 etc]# chage -l ed
Last password change : Jun 24, 2009
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 23
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
[root@101 etc]#
----
[root@101 etc]# chage -E 2009-07-07 ed
[root@101 etc]# chage -l ed
Last password change : Jun 24, 2009
Password expires : never
Password inactive : never
Account expires : Jul 07, 2009
Minimum number of days between password change : 23
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
[root@101 etc]#"
 
Old 07-06-2009, 01:30 PM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,487

Rep: Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882
Take a look at chage
http://www.thegeekstuff.com/2009/04/...ion-and-aging/
 
Old 07-06-2009, 01:40 PM   #6
Linuxwho?
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by repo View Post
chage -M number-of-days username worked! It changes the "Maximum number of days between password change" but also the expiration date itself. TY for the link repo!!

p.s. The man pages are ok but geared more toward trial and error rather than being real specific. I am fighting with this myself sometimes when trial and error must be the autonomous solution,lol. Still it is much appreciated getting the help on here. Great site!

Last edited by Linuxwho?; 07-06-2009 at 01:42 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to check the password expiry date of a user? binary_0011 Other *NIX 1 06-04-2008 01:37 AM
expire date in useradd ALInux Linux - Security 2 11-08-2005 08:30 AM
how expire password automatically manudath Linux - Security 2 04-27-2005 12:38 AM
samba password expire Peds222 Linux - Newbie 1 03-12-2005 04:34 PM
Samba -> Expire password Tiago Cruz Linux - Networking 6 03-05-2003 07:21 AM


All times are GMT -5. The time now is 09:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration