Linux查看用户过期时间及禁用用户登陆

发布时间:2024年01月05日

修改用户为非登陆类型用户

[root@localhost]#usermod haha-s /sbin/nologin
[root@localhost]# cat /etc/passwd

haha:x:1002:1002::/home/haha:/sbin/nologin
?

查看用户密码过期时间

[root@localhost]# chage -l haha
Last password change?? ??? ??? ??? ??? ?: Nov 05, 2021
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,真实时间为an 02, 1970?
[root@localhost]# usermod --expiredate 1 haha

[root@localhost]# chage -l haha

Last password change?? ??? ??? ??? ??? ?: Dec 09, 2019
Password expires?? ??? ??? ??? ??? ?: never
Password inactive?? ??? ??? ??? ??? ?: never
Account expires?? ??? ??? ??? ??? ??? ?: Jan 02, 1970?
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
?

文章来源:https://blog.csdn.net/wyhwlls/article/details/135410519
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。