Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Modification 1

Status
Not open for further replies.

nani3456

Vendor
Feb 4, 2004
56
0
0
US
Hi Guys,

Can someone help me in finding out all the users who had changed there password .

Can I find date and time when their changed password in human readable format.(/etc/security/passwd)



Thanks
 
Try this:

pwdadm -q user_name

This command will show the lastupdate attribute

Regards,
Khalid
 
Code:
lastupdate Specifies the time (in seconds) since the epoch (00:00:00 GMT, January 1, 1970) when the password was last changed. If password aging (the minage attribute or the maxage attribute) is in effect, the lastupdate attribute forces a password change when the time limit expires. (See the /etc/security/user file for information on password aging.) The passwd and pwdadm commands normally set this attribute when a password is changed. The value is a decimal integer that can be converted to a text string using the ctime subroutine.


Regards,
Khalid
 
Here is a quick little script that will list all of the users on the system and the date when they last changed their password.

Code:
#!/bin/ksh
# set seperator to :
# get usernames from /etc/passwd

IFS=:
while read -r USER JUNK JUNK JUNK JUNK JUNK JUNK
do

# for each username, get the last password update time - in seconds
# since the epoch

LUP=$(lssec -f /etc/security/passwd -s $USER -a lastupdate|cut -f2 -d=)
NRM_DATE=$(perl -e "print scalar localtime($LUP);")

#print the username and the last pw change date

echo "          User: $USER"
echo "Last PW change: $NRM_DATE"
echo ""

done < /etc/passwd
 
Hi Brews,

Thanks for an excelect script, this really solved my problem.

Take a star.

Thanks and Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top