码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2018-03-21 16:38:09      阅读:640      评论:0      收藏:0      [点我收藏+]

标签:linux

查看root用户密码上次修改的时间

方法一:
查看日志文件:
# 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
技术分享图片

第三段字符就是最近一次密码修改的天数,此数字是距离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日。

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

标签:linux

原文地址:http://blog.51cto.com/qiangsh/2089439

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!