Bug 1183638

Summary: Issue using chage command to remove account expiration date.
Product: Red Hat Enterprise Linux 6 Reporter: Chinmay Paradkar <cparadka>
Component: shadow-utilsAssignee: Tomas Mraz <tmraz>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.6CC: atolani, cameronbaker17, dapospis, ekeck, jkurik, jsvarova, ksrot, pkis, tmraz
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: shadow-utils-4.1.4.2-20.el6 Doc Type: Bug Fix
Doc Text:
Previously, the system administrator could not remove the account expiration date and the date of the last password change using the "chage -E -1" and "chage -d -1" commands. The bug in the "date" parsing code has been fixed, and it is again possible to remove the account expiration date and the date of the last password change using the aforementioned commands.
Story Points: ---
Clone Of:
: 1206273 (view as bug list) Environment:
Last Closed: 2015-10-22 09:35:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1206273    

Description Chinmay Paradkar 2015-01-19 11:11:50 UTC
Description of problem:

Issue using chage command to remove Account expiration date. The year format in "Account expires" is wrong.

Version-Release number of selected component (if applicable):

shadow-utils-4.1.4.2-19.el6.x86_64

How reproducible:
This issue is reproducible with shadow-utils-4.1.4.2-19.el6.x86_64 package on RHEL-6.5 and RHEL-6.6.

Steps to Reproduce:

# chage -l friday
Last password change                                    : Jan 19, 2015
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

# chage -E -1 friday

Actual results:

# chage -l friday
Last password change					: Jan 19, 2015
Password expires 					: never
Password inactive					: never
Account expires						: Jan 20, 11761191
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

Expected results:

# chage -l friday
Last password change					: Jan 19, 2015
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

Additional info:

I have noted the entry "-2" is added in 8th column of "/etc/shadow" file.

# grep friday /etc/shadow
friday:$6$dBs1aWNG$ahInXkaUiM20opsZCGuvjRcUedH3iGVG3Fv3LzfuhR.3qgHvBbgNyyFlhiT/HOo8XRC7ZieHkwCMTMUqHmZdA/:16454:0:99999:7::-2:

The workaround for this is to manually edit the configuration file "/etc/shadow" and remove the entry "-2", it will reset the value for "Account expires" to default.

Comment 3 Tomas Mraz 2015-01-20 17:11:44 UTC
You can use
chage -d '' <account>
instead of editing the file manually.

Comment 4 Tomas Mraz 2015-01-20 17:12:45 UTC
I meant use
chage -E '' <account>
of course.

Comment 5 Chinmay Paradkar 2015-01-21 02:20:29 UTC
1) Running "chage" for a new user:

# chage -l chinmay
Last password change					: Jan 21, 2015
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

2) Removing account expiration date.

# chage -E -1 chinmay

# chage -l chinmay
Last password change 					: Jan 21, 2015
Password expires				        : never
Password inactive					: never
Account expires						: Jan 20, 11761191
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

3) Testing the command with provided option. 

# chage -E '' chinmay
chage: invalid date ''
Usage: chage [options] [LOGIN]

Options:
  -d, --lastday LAST_DAY        set date of last password change to LAST_DAY
  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -h, --help                    display this help message and exit
  -I, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --list                    show account aging information
  -m, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -M, --maxdays MAX_DAYS        set maximim number of days before password
                                change to MAX_DAYS
  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS

# chage -E ' ' chinmay

# chage -l chinmay
Last password change					: Jan 21, 2015
Password expires					: never
Password inactive					: never
Account expires						: Jan 21, 2015
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

The above command causes the account to expire immediately, instead of removing the account expiration date.

Comment 12 Tomas Mraz 2015-03-25 18:01:59 UTC
*** Bug 1184184 has been marked as a duplicate of this bug. ***

Comment 13 Tomas Mraz 2015-03-25 18:02:03 UTC
*** Bug 1183993 has been marked as a duplicate of this bug. ***