linux 查看用户上次修改密码的日期

977 阅读1分钟

方法一:

查看日志文件:

cat /var/log/secure |grep ‘password changed‘

方法二:

chage -l root


Last password change : Feb 27, 2018

Password expires : never

Password inactive : never

Account expires : never

Minimum number of days between password change : 0

Maximum number of days between password change : 99999

Number of days of warning before password expires : 7

方法三:

1、找到以下文件:

cat /etc/shadow

f8210abe311bdeb05fb28da94f89777d.png

第三段字符就是最近一次密码修改的天数,此数字是距离1970年1月1日的天数。

2、用以下命令计算:

date -u -d "1970-01-01 UTC $((17589 * 86400 )) seconds"

Tue Feb 27 00:00:00 UTC 2018

结果是:2018年2月27日。

原文:blog.51cto.com/qiangsh/208…