找回密码
 注册
查看: 200|回复: 0

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-10-26 16:00:02 | 显示全部楼层 |阅读模式
linux系统查看修改用户密码过期时间
$ R  n5 b# j0 ?1 I8 t' \查看:
# A) A6 F0 T' I+ A* F! R  F# chage -l devopsLast password change                                        : Oct 26, 2023" i. f* H0 B8 Y2 z4 Q
Password expires                                        : Nov 25, 20233 z( r& ?6 i" l) T$ i/ N
Password inactive                                        : Jan 24, 2024
0 d1 y# i9 ?9 c, W, k+ wAccount expires                                                : never
. W+ s3 l3 m$ ]: @$ ?6 _+ f0 }+ RMinimum number of days between password change                : 0
7 R2 R! E: v/ ^" G( [0 a" fMaximum number of days between password change                : 309 X" t# G" B) {+ |
Number of days of warning before password expires        : 72 I' j+ E2 c% A# {6 o
% U4 M8 o: N2 f9 Z# g
查看系统所有用户的:. Z* A. W- ~9 q" ?
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'
' {' R3 t7 V/ W* X# t& O' D# R- A; F; l0 P3 N/ e' W0 p

: t# S6 y9 C- B& e( |& upasswd  -S devops
4 G: V/ _' a8 S! ldevops PS 2023-10-26 0 30 7 60 (Password set, SHA512 crypt.)
1 C# Z+ ~, r+ Y+ F5 S: k) H! Y0 T5 G& |: m% i
" I  n1 ?1 K# y# d/ P
& Q4 f7 i" r1 D) w' V6 p' n
# chage -l devops: D! P# m* m3 J# ^* Q1 `0 S
Last password change
) U! S1 ]" D) m3 h4 [, c, {; }! ~$ {$ B& a$ c+ Q6 `
修改:. n5 `0 f: F' z9 W. h5 ~7 M) r
chage -M 99999 devops
& D- _" S, d: [/ k% B. ^! e# chage -l devops
( R5 L# r0 G  J; d# X* B5 {Last password change                                        : Oct 26, 2023
4 l3 q& ]3 I  O' EPassword expires                                        : never' K4 N7 _* }" V5 B, i4 G" o- j
Password inactive                                        : never/ k6 @% {* ~- C3 V! X* X5 n0 y
Account expires                                                : never
* a6 g- w) U4 M. J) W8 I* qMinimum number of days between password change                : 04 H" x$ }' F; m7 |, z, l
Maximum number of days between password change                : 999999 h4 p# g! }1 @2 B  h( C
Number of days of warning before password expires        : 7( W, B( l  ?, f9 r. {* b! b
4 U' Z& ^9 Q0 n4 a* @, j

4 u$ t! ^+ n2 B6 o6 K  U$ j0 W6 o7 `+ ]. T4 R: V
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:27 , Processed in 0.013764 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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