Fangrn 发表于 2013-2-7 12:35:35

check 系统账号密码是否过期shell脚本

自己写的check aix系统用户密码是否过期的shell 脚本,单位环境是设置用户密码3个月过期,时间长了经常有账户密码过期。供大家参考。
# Check user password expiredcurrenttime=`perl -le "print scalar time" `maxage=`grep -p default: /etc/security/user | awk '$1 ~ /maxage/ {print $3}'`expiretime=`expr $maxage \* 604800`userlist=`cat /etc/passwd |awk -F ":" '{ print $1 }'`count=0for i in $userlist ; dogrep -p ^${i}: /etc/security/passwd | awk '$1 ~ /lastupdate/ {print $3}' | read lastupdate &&threshold=`expr $currenttime - $lastupdate`if [ $threshold -gt $expiretime ]    thencount=`expr $count + 1`echo "${i}"fidoneif [ $count -eq 0 ]thenecho "None"fi
页: [1]
查看完整版本: check 系统账号密码是否过期shell脚本