Monday 10 March 2014

To check the last login time, using perl

 # lsuser sankar
sankar id=40753 pgrp=itc groups=itc,staff home=/home/sankarar shell=/usr/bin/ksh gecos=SANKAR , login=true su=true rlogin=true daemon=true admin=false sugroups=ALL admgroups= tpath=nosak ttys=ALL expires=0 auth1=SYSTEM auth2=NONE umask=22 registry=files SYSTEM=compat logintimes= loginretries=0 pwdwarntime=0 account_locked=false minage=0 maxage=26 maxexpired=2 minalpha=2 minother=1 mindiff=4 maxrepeats=2 minlen=8 histexpire=0 histsize=0 pwdchecks= dictionlist=/etc/security/aixpert/dictionary/English default_roles= fsize=-1 cpu=-1 data=262144 stack=65536 core=2097151 rss=65536 nofiles=2000 time_last_login=1332327025 time_last_unsuccessful_login=1329801313 tty_last_login=/dev/pts/0 tty_last_unsuccessful_login=ssh host_last_login=198.200.189.87 host_last_unsuccessful_login=198.213.208.27 unsuccessful_login_count=0 roles=



 time_last_login=1332327025


server1:/root #  perl -le 'print scalar localtime 1332327025'
Wed Mar 21 03:50:25 2012


Note : You can check the same in "last | grep sankar"..... But, if the user didnt login to the server for years time... then you may not get the info from "last" command... Because, last log will keep the info for few months and it will rotate...

No comments:

Post a Comment