password will expire

login: TEST7
TEST7's Password:
Your password will expire: Wed Feb 19 14:28:08 2003

How can I the same information become in a script (as example
in the .profile)?????????

My login starts with .profile. These File is a menue with 24 lines and the message " Your password ....." disappear
to the top of the screen and the user can't see the message.

My System is a AIX 4.3.2
All Users are defined with pwdwarntime=7

thanks to all helpful Unix-Cracks

I believe you need someone with a bit more AIX experience than I have (especially since it's been years since I have been on one) but the concept should be the same.

Find your secure password file (try /etc/security/passwd) and look for the lastupdate field.

You should be able to grab out the info from the lastupdate field and using Perl figure out when it will expire.

Check out the info at IBM - password security for more info. Also, you might be able to use some of the information from an old post perl script - changing password

The easy solution is to put a "Hit return to start menu" so they can read any info that may be there before you put the menu out to their screen.

Thank to RTM,

J have the same idea, to stop the script.
It works good, but the solution is'nt good looking.

Can some where help.
I search a command like this:

 test passwdexpired USERNAME

output: your password will expire at .....

the newest status:

in the dir /etc/seurity file passwd
you can find follows entries

TEST7:
password = 9SxsMS2A/vUX2
lastupdate = 1046262871
flags =

for all Users

in the example TEST7

    lastupdate  is the time in seconds beginning  
                       at 01.01.70    \(or 69\)
                       that is the RTC \(Real Time Clock\) 

if you change your password, the lastupdate in seconds will
be there.

what you need is the time in seconds from 01.01.70 to now

(i need a calendar programm from date to date in seconds)

the next step is only a subtraction

Take a look at my datecalc script which has been posted to this site. If you use it together with a little bit of algebra you should be able to do what you want.

I just displayed my system clock and got 1046356359.

datecalc -j $(( (1046356359 / (24*60*60)) + $(datecalc -j 1970 1 1) ))
will display:
2003 2 27

Thank to Perderabo for the script.

But - how can I

display my system clock and got the seconds (1046356359).

Please send me the Command

Many thanks from
Erwin Stocker

In Perl...

#!/u/bin/perl
# (Your location of Perl may be different)
===========================================
$epoch= time ();
print "$epoch\n";

Output of this....

# ./cd.pl
1046442456 

To get this down to days (if your not worried about how many hours, minutes, seconds...)

#!/u/bin/perl
#
#       checkdate - a script to check a date (how long ago)
#       Parameter 1 is entry from /etc/shadow - 3rd field - SUN OS
#       Created 05/07/02 HOG
# =======================================
# Set up variables
$getepoch= time () /60 /60 /24 ;
($nowepoch, $junk) = split (/\./, $getepoch, 2);
$arguement = $ARGV[0];
$diff=$nowepoch - $arguement;
print "Password reset $diff days ago - $nowepoch - $arguement\n";

Output of this...
# ./checkdate.pl 11989
Password reset 122 days ago - 12111 - 11989

12111 is today, 11989 was 122 days ago

added code tags for readability --oombera

You're welcome!

As for the command, I used the sequence:

adb -k /stand/vmunix /dev/mem
time/D
$q

However, that is specific to HP-UX and I don't know that I would really recommend it as a good solution even on HP-UX.

Just for fun:

echo $(( ($(datecalc -j $(date -u "+%Y %m %d")) - $(datecalc -j 1970 1 1))
 * (24*60*60) + $(date -u "+((( %H * 60) + %M ) * 60 + %S)" | sed 's/ 0/ /g') ))

I guess that I would have to go with perl as the best game in town. That first script that RTM posted can actually be condensed into:
perl -e 'print time(),"\n"'
(Note that the above line ends with double quote, then single quote.)

However, I'm not sure why you want to do this. I thought that you had a data file with the raw seconds already in it. I was just using the current time as an example.

Not sure about the date(1) on AIX, but many date commands have this as an option. GNU date uses the +%s modifier, and at least one of the BSD's have a date command that allows you to show seconds since 1970.