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

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-10-26 16:00:02 | 显示全部楼层 |阅读模式
linux系统查看修改用户密码过期时间
0 A/ M: r, E7 s- k: M: ~8 I5 c7 ^查看:
% h% [- u8 v( M$ {/ x! _# chage -l devopsLast password change                                        : Oct 26, 2023
! y$ t' X& U8 T0 f# ^/ OPassword expires                                        : Nov 25, 2023* a; C+ }  U7 A* a' w1 b6 i
Password inactive                                        : Jan 24, 20247 R  O6 }: o& p% w8 M. s3 S* [6 g
Account expires                                                : never
4 E* s/ U% D! Y- _Minimum number of days between password change                : 0+ _# C8 r$ P0 l7 o
Maximum number of days between password change                : 30
# U/ p  t$ k3 ?% n# T) A4 q, F. Z' VNumber of days of warning before password expires        : 7% O$ e$ W5 [  w4 [) \) y6 @

: c9 s5 o7 l, o# b, \查看系统所有用户的:
3 x5 C. r" C& S  R1 i7 G2 Afor 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'
# L, E2 h: x; O8 {5 K( f
& b* |( S, h7 h+ c9 V1 T# s' h
' P2 M& m2 V( K1 b5 ppasswd  -S devops
- q% i5 _# y8 h% E- _devops PS 2023-10-26 0 30 7 60 (Password set, SHA512 crypt.)
  E. A+ h( t5 G
3 O$ Z1 P0 M2 T' x8 w! f; y4 o5 f4 k  [7 Y" ]- H9 U" `
3 b5 ]$ H# @" Y
# chage -l devops
" P8 J: w/ |3 H+ e/ e: [Last password change
, J) u& a5 X. ]. H# G. C$ ?, w
9 S6 y8 T' L6 s) m修改:
6 X- I* k9 D0 u6 ~% a- m  f: hchage -M 99999 devops' R5 L( {; K! R- w# w
# chage -l devops) n6 k) S2 Q! _. k
Last password change                                        : Oct 26, 2023$ u/ X# L: t4 u, L
Password expires                                        : never: U) o7 D' }6 v- G8 U
Password inactive                                        : never& }2 T! Z# U- h+ ]
Account expires                                                : never% E9 f' Z6 }: N$ v% X
Minimum number of days between password change                : 0
& O! o! Q% S, K3 c6 {4 @Maximum number of days between password change                : 99999" z- q$ W0 U5 G; B
Number of days of warning before password expires        : 7  j/ U: o# ~& G$ C: t  h! ]
4 v6 j' j$ @% s

+ j  U9 R8 Y+ N; y, w7 O: ^2 x
+ Z/ }( q. n. R! R
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 01:33 , Processed in 0.020033 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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