- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: calculate the number of days left for password...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 05:10 AM
02-04-2003 05:10 AM
To check passwd expiry time :-
root->/usr/lbin/getprpw -m exptm sapr3
exptm=730
last successfull passwd change:-
root->/usr/lbin/getprpw -m spwchg sapr3
spwchg=Thu Jul 4 15:42:02 2002
Current date
# date
Tue Feb 4 20:34:16 SST 2003
days left to to expire passwd =730 - (current date -spwchg date)
Need to convert two dates into numeric value.
Thanks for your time
Animesh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 05:15 AM
02-04-2003 05:15 AM
Re: calculate the number of days left for password expiry
What you need is Clay's "date hammer", caljd.sh. See this thread for info (from Clay himself):
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x2b9d4a988422d711abdc0090277a778c,00.html
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 05:54 AM
02-04-2003 05:54 AM
Re: calculate the number of days left for password expiry
Take a look at next question beleave it will help.
Kind regards,
Robert-Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 05:54 AM
02-04-2003 05:54 AM
Re: calculate the number of days left for password expiry
Take a look at next question beleave it will help.
Kind regards,
Robert-Jan.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x82afba808b46d611abda0090277a778c,00.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 06:10 AM
02-04-2003 06:10 AM
Re: calculate the number of days left for password expiry
I have already tried Clay's perl script
but it is not showing the correct result.
root>perl passwarn.pl ac
ac 4096
cttrg:>passwd -s ac
ac PS 01/22/03 0 60 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 06:57 AM
02-04-2003 06:57 AM
Solutionplease try the following script. ATTACHED_SCRIPT must be customised with the path to the attached script and USER set to the user you want to examine.
#!/usr/bin/sh
# Define path to attached script.
#
ATTACHED_SCRIPT=""
# Set the user to examine...
#
USER=""
EXP_DAYS=`/usr/lbin/getprpw -m exptm "$USER"| awk -F= '{print $2}'`
if [ "$EXP_DAYS" = "-1" ]
then
echo $USER does not expire
exit 1
fi
EXP_DAYS_IN_SECS=$(( $EXP_DAYS \* 86400 ))
LAST_CHANGE=`/usr/lbin/getprpw -m spwchg "$USER"| awk -F= '{print $2}'`
# Cut out the various items..
#
L_C_YEAR=`echo $LAST_CHANGE| awk '{print $5}'`
L_C_MONTH=`echo $LAST_CHANGE| awk '{print $2}'`
L_C_DAY=`echo $LAST_CHANGE| awk '{print $3}'`
L_C_HOUR=`echo $LAST_CHANGE| awk '{print $4}'| awk -F: '{print $1}'`
L_C_MINUTE=`echo $LAST_CHANGE| awk '{print $4}'| awk -F: '{print $2}'`
L_C_SECOND=`echo $LAST_CHANGE| awk '{print $4}'| awk -F: '{print $3}'`
# Number of seconds since last change
#
SECS_SINCE_LAST_CHANGE=`$ATTACHED_SCRIPT 1970 $L_C_YEAR $L_C_MONTH $L_C_DAY $L_C
_HOUR $L_C_MINUTE $L_C_SECOND`
# Current date in seconds
#
CURRENT_DATE_SECS=`$ATTACHED_SCRIPT`
# Calculate num. of secs since last change
#
WHEN_SECONDS=$(( $EXP_DAYS_IN_SECS - ( $CURRENT_DATE_SECS - $SECS_SINCE_LAST_CH
ANGE) ))
# Turn seconds into days
#
WHEN_DAYS=$(( $WHEN_SECONDS \/ 86400 ))
echo $WHEN_DAYS
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 07:24 AM
02-04-2003 07:24 AM
Re: calculate the number of days left for password expiry
I attached a small C-Program you
should compile with -lsec
The program will go through passwd and print the expiration date and life-time of the password
Regards
Rainer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2005 12:12 AM
03-24-2005 12:12 AM
Re: calculate the number of days left for password expiry
How to use this script.
When I run the script I get the following error: Syntax error at line 16 : `&' is not expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2007 03:33 AM
02-07-2007 03:33 AM
Re: calculate the number of days left for password expiry
Thanks
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2007 03:47 AM
02-07-2007 03:47 AM
Re: calculate the number of days left for password expiry
FD_EXPIRE for aydin IS 0
FD_EXPIRE for bhandara IS 0
FD_EXPIRE for rross IS 0
So .. The program is retrieving the info from getprpwent, but finging that fd-expire for ALL users is '0'