Skip to contentSkip to conversation

change user password usable time

PATCH In review lina.zhao 2 participants 2 messages Sep 16, 2010

lore
Share & tools
lore

lina.zhao

author
#0 lore raw

PATCH 1/1 change user password usable time

Hi,

Some board do not have a RTC, then when it boot up, the time is 1970.1.1.

if Linux finds 'last password change date' of an account = 1/1/1970 , it forces password change on next login.
if the systems' date is like that and you change (as required) the password, each time you login on the same day it will require you to change password.

So in the target whose boot up time is 1/1/1970 and use the 'su' command, there will be 'You are required to change your password immediately (root enforced)' informations and stop the testing.

chage -d 10 userName will let the userName is usable in the next 10 days.

Thanks,

Lina

From a76578071c5319f47420777fc349c470dcd198aa Mon Sep 17 00:00:00 2001
From: Lina Zhao <[email protected]>
Date: Thu, 16 Sep 2010 11:17:33 +0800
Subject: [PATCH] change user password expiry time

Some board do not have a RTC, then when it boot up, the time is 1970.1.1. if Linux finds 'last password change date' of an account = 1/1/1970 , it forces password change on next login.
So in the target whose boot up time is 1/1/1970 and use the 'su' command, there will be 'You are required to change your password. informations and stop the testing.

chage -d 10 userName will let the userName is usable in the next 10 days.

---
 testcases/commands/at/at_deny01      |    2 ++
 testcases/commands/cron/cron02       |    1 +
 testcases/commands/cron/cron_allow01 |    2 ++
 testcases/commands/cron/cron_deny01  |    2 ++
 testcases/commands/su/su01           |    2 ++
 5 files changed, 9 insertions(+), 0 deletions(-)
testcases/commands/at/at_deny01 +2 -0
index 9f9f433..3a0a711 100755
@@ -64,12 +64,14 @@ do_setup()
 		echo "Could not add test user ${test_user1} to system."
 		exit 1
 	fi
+   chage -d 10 ${test_user1}
 
 	# Create the 2nd user.
 	if ! useradd -g users -d "${test_user2_home}" -m "${test_user2}"; then
 		echo "Could not add test user ${test_user2} to system."
 		exit 1
 	fi
+   chage -d 10 ${test_user2}
 
 	# This is the workaround for a potential bug.
 	# [Bug 468337] At Refuse to Work with Non-login Shell
testcases/commands/cron/cron02 +1 -0
index 0c05c95..2ca2d88 100755
@@ -51,6 +51,7 @@ do_setup(){
                 exit 1
         }
         fi
+        chage -d 10 $TEST_USER
 
 	# restart cron daemon
 	# Red Hat uses crond, SuSE/Other uses cron.
testcases/commands/cron/cron_allow01 +2 -0
index ffecf68..86c5296 100755
@@ -68,6 +68,7 @@ do_setup() {
         exit 1
     }
     fi
+    chage -d 10 $TEST_USER1
 
 #create 2nd user	
 	useradd -m -g users $TEST_USER2
@@ -77,6 +78,7 @@ do_setup() {
         exit 1
     }
     fi
+    chage -d 10 $TEST_USER2
 }
 
 #-----------------------------------------------------------------------
testcases/commands/cron/cron_deny01 +2 -0
index 957529b..b1f8263 100755
@@ -72,6 +72,7 @@ do_setup() {
         exit 1
     }
     fi
+    chage -d 10 $TEST_USER1
 
 #create 2nd user	
 	useradd -m -g users $TEST_USER2
@@ -81,6 +82,7 @@ do_setup() {
         exit 1
     }
     fi
+    chage -d 10 $TEST_USER2
 }
 
 #-----------------------------------------------------------------------
testcases/commands/su/su01 +2 -0
index 0a99514..d589365 100755
@@ -115,6 +115,7 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
                 exit 1
         }
         fi
+        chage -d 10 $TEST_USER1
 
 #Create 2nd test user
 	#erase user if he may exist , so we can have a clean en
@@ -151,6 +152,7 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
                 exit 1
         }
         fi
+        chage -d 10 $TEST_USER2
 }
 
 
Signature · 1 line
1.6.3.1

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 10 lines · lina.zhao

Hi,

Some board do not have a RTC, then when it boot up, the time is 1970.1.1.

if Linux finds 'last password change date' of an account = 1/1/1970 , it forces password change on next login.
if the systems' date is like that and you change (as required) the password, each time you login on the same day it will require you to change password.

So in the target whose boot up time is 1/1/1970 and use the 'su' command, there will be 'You are required to change your password immediately (root enforced)' informations and stop the testing.

chage -d 10 userName will let the userName is usable in the next 10 days.

Again, this is more of an environment issue with your board than anything else, and can be easily resolved by calling ntpdate on the board, so... I still don't see the usefulness of this functionality if it's just applied in one set of scripts (again, half-measures are very undesirable because they're more painful to maintain). It can be solved via an init.d script or an upstart job file in a matter of a few lines.
Thanks,
-Garrett
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list