六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 94|回复: 0

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

[复制链接]

升级  7.2%

166

主题

166

主题

166

主题

进士

Rank: 4

积分
536
 楼主| 发表于 2013-1-28 23:25:49 | 显示全部楼层 |阅读模式
自己写的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 ; do  grep -p ^${i}: /etc/security/passwd | awk '$1 ~ /lastupdate/ {print $3}' | read lastupdate &&  threshold=`expr $currenttime - $lastupdate`  if [ $threshold -gt $expiretime ]    then  count=`expr $count + 1`  echo "${i}"  fidone  if [ $count -eq 0 ]thenecho "None"fi
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表