- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
linux系统查看修改用户密码过期时间, F7 T7 Y6 u6 s8 M/ i" n
查看:
* P8 S" b% S2 I, I- u Q! z2 w# chage -l devopsLast password change : Oct 26, 2023% c7 e7 \+ u7 y9 }/ Q1 T9 r4 c
Password expires : Nov 25, 2023
# b- B* a/ [9 z1 s, `0 ePassword inactive : Jan 24, 2024; ~; m$ K4 l' d
Account expires : never, C( |1 I2 m3 x2 f
Minimum number of days between password change : 0
+ s5 r) c' v# m$ y8 jMaximum number of days between password change : 30
" L' T% n0 K0 DNumber of days of warning before password expires : 78 ?# [$ p: n& G O
5 m* G: T; [& j查看系统所有用户的:
% z' ?. z/ g( x2 x. U. c1 j/ ?* A* }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'
2 o5 }$ t# c( Y% K3 r
7 h4 n) f- {/ z% ~2 ~' g
( U* k8 G: @9 d) rpasswd -S devops
5 x8 }% P5 a3 d# y; C( q Edevops PS 2023-10-26 0 30 7 60 (Password set, SHA512 crypt.)3 L8 L- N7 I, h5 D+ n
% B, p- y! z! S8 z
, A" V/ m; P( C! r3 x3 m
4 N& k4 i" r; k1 [8 X# chage -l devops
6 q; [6 f0 |& PLast password change
: T7 r0 b0 g4 j7 z2 i+ k: ]+ ?; y/ h& K; t( m; G! v9 d& A) J
修改:
' X. h6 y7 v% b I' L7 J; nchage -M 99999 devops8 ?6 l7 v3 d, @& b+ Z- b1 o
# chage -l devops
8 z" V" X5 |6 U% C& C8 _- rLast password change : Oct 26, 20236 s1 c. P( ~ S. o8 b" q
Password expires : never
$ h3 g R* X: e3 rPassword inactive : never0 b. M2 K. d# K
Account expires : never( x/ E4 m* `5 S; E( p4 t: ]3 C1 Z
Minimum number of days between password change : 0# h% B9 m; H2 i" R
Maximum number of days between password change : 99999/ u. [7 d) D2 V5 `: U+ @
Number of days of warning before password expires : 7
' }0 e! _4 y6 }, _- ~& r' Z
3 c; H( @9 S- |: m: K7 K/ K7 n$ ?' n1 c% J) y( V& V* y. B( z7 {+ @" Q
& K6 B% m7 ^2 U6 l1 h" c
|
|