AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
Expand all | Collapse all

AIX account not logged on for 90 days

  • 1.  AIX account not logged on for 90 days

    Posted Sun April 20, 2008 03:49 AM

    Originally posted by: SystemAdmin


    I want to extract all AIX accounts that has not been logged on in the system for more than 90 days as a housekeeping method. Anyone know how to do that?
    #AIX-Forum


  • 2.  Re: AIX account not logged on for 90 days

    Posted Mon April 21, 2008 07:36 AM

    Originally posted by: SystemAdmin


    Hei,

    May this script could help you.


    #!/bin/ksh

    _MAX_DAY_WITHOUT_LOG=90

    _MAX_DAY_WITHOUT_LOG_IN_SECOND=$(( ${_MAX_DAY_WITHOUT_LOG} * 24 * 3600 ))

    _TODAY=$( date "+%s" )
    for _USER in $( grep ":$" /etc/security/lastlog | grep -v "^*" )
    do
    _TSTP=$( grep -p ${_USER} /etc/security/lastlog | grep time_last_login | sed -e "s/.*\= //" )

    _USER_TIME_WITHOUT_LOGING=$(( ${_TODAY} - ${_TSTP} ))

    if
    then
    echo ${_USER} | sed -e "s/://g"
    fi

    done

    exit 0


    Run as root or a user who can read the /etc/security/lastlog file.

    Regards

    Message was edited by: Rygel_3rd
    #AIX-Forum