1. 程式人生 > >linux 查看用戶上次修改密碼的日期

linux 查看用戶上次修改密碼的日期

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 查看用戶上次修改密碼的日期