admin 发表于 2023-10-26 16:00:02

linux系统查看修改用户密码过期时间

linux系统查看修改用户密码过期时间
查看:
# chage -l devopsLast password change                                        : Oct 26, 2023
Password expires                                        : Nov 25, 2023
Password inactive                                        : Jan 24, 2024
Account expires                                                : never
Minimum number of days between password change                : 0
Maximum number of days between password change                : 30
Number of days of warning before password expires        : 7

查看系统所有用户的:
for user in $(cat /etc/passwd |cut -d: -f1); do echo $user; chage -l $user | grep "Password expires"; done | paste -d " "- - | sed 's/Password expires//g'


passwd-S devops
devops PS 2023-10-26 0 30 7 60 (Password set, SHA512 crypt.)



# chage -l devops
Last password change

修改:
chage -M 99999 devops
# chage -l devops
Last password change                                        : Oct 26, 2023
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]
查看完整版本: linux系统查看修改用户密码过期时间