Linux用户和组的操作(九) 修改用户账号密码时间参数 chage
2013-03-12 17:42
661 查看
使用chage(change age)命令也可以修改用户账号密码的时间参数,而且可以直观显示。
chage命令行选项:
[root@localhost ~]# chage -d 2013-03-01 -m 5 -M 180 -W 7 -I 10 -E 2013-12-30 stone
#修改stone的账号密码时间参数
[root@localhost ~]# chage -l stone
Last password change : Mar 01, 2013
Password expires : Aug 28, 2013
Password inactive : Sep 07, 2013
Account expires : Dec 30, 2013
Minimum number of days between password change : 5
Maximum number of days between password change : 180
Number of days of warning before password expires : 7
#列出stone的账号时间参数
[root@localhost ~]# chage stone
Changing the aging information for stone
Enter the new value, or press ENTER for the default
Minimum Password Age [5]: 6
Maximum Password Age [180]: 150
Last Password Change (YYYY-MM-DD) [2013-03-01]: 2013-3-10
Password Expiration Warning [7]: 5
Password Inactive [10]: 7
Account Expiration Date (YYYY-MM-DD) [2013-12-30]: 2013-10-1
#不使用命令选项直接加用户名,可交互修改账户时间参数
[root@localhost ~]# chage -l stone
Last password change : Mar 10, 2013
Password expires : Aug 07, 2013
Password inactive : Aug 14, 2013
Account expires : Oct 01, 2013
Minimum number of days between password change : 6
Maximum number of days between password change : 150
Number of days of warning before password expires : 5
[root@localhost ~]# useradd agetest
[root@localhost ~]# echo "agetest" | passwd --stdin agetest
Changing password for user agetest.
passwd: all authentication tokens updated successfully.
[root@localhost ~]# chage -d 0 agetest
#新建用户agetest,并将密码设置为agetest,设置密码修改日期为0。
[root@localhost ~]# su – stone
#切换用户
[stone@localhost ~]$ su - agetest
Password:
You are required to change your password immediately (root enforced)
Changing password for agetest
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
#第一次登陆提示用户修改密码,参考了《鸟哥私房菜》。
本文出自 “石头记” 博客,请务必保留此出处http://stonebox.blog.51cto.com/5409313/1152713
chage命令行选项:
选项[/b] | 含义[/b] |
-l [/b] | 列出用户账号密码的详细时间参数[/b] |
-d [/b] | 修改密码修改日期,/etc/shadow中第三字段,为0表示第一次登陆强制修改密码 |
-m [/b] | 修改密码冻结天数,/etc/shadow中第四字段 |
-M[/b] | 修改密码有效天数,/etc/shadow中第五字段 |
-W[/b] | 修改密码警告天数,/etc/shadow中第六字段 |
-I[/b] | 修改密码宽限天数,/etc/shadow中第七字段,为-1表示不会失效 |
-E[/b] | 修改账号失效日期,/etc/shadow中第八字段 |
#修改stone的账号密码时间参数
[root@localhost ~]# chage -l stone
Last password change : Mar 01, 2013
Password expires : Aug 28, 2013
Password inactive : Sep 07, 2013
Account expires : Dec 30, 2013
Minimum number of days between password change : 5
Maximum number of days between password change : 180
Number of days of warning before password expires : 7
#列出stone的账号时间参数
[root@localhost ~]# chage stone
Changing the aging information for stone
Enter the new value, or press ENTER for the default
Minimum Password Age [5]: 6
Maximum Password Age [180]: 150
Last Password Change (YYYY-MM-DD) [2013-03-01]: 2013-3-10
Password Expiration Warning [7]: 5
Password Inactive [10]: 7
Account Expiration Date (YYYY-MM-DD) [2013-12-30]: 2013-10-1
#不使用命令选项直接加用户名,可交互修改账户时间参数
[root@localhost ~]# chage -l stone
Last password change : Mar 10, 2013
Password expires : Aug 07, 2013
Password inactive : Aug 14, 2013
Account expires : Oct 01, 2013
Minimum number of days between password change : 6
Maximum number of days between password change : 150
Number of days of warning before password expires : 5
[root@localhost ~]# useradd agetest
[root@localhost ~]# echo "agetest" | passwd --stdin agetest
Changing password for user agetest.
passwd: all authentication tokens updated successfully.
[root@localhost ~]# chage -d 0 agetest
#新建用户agetest,并将密码设置为agetest,设置密码修改日期为0。
[root@localhost ~]# su – stone
#切换用户
[stone@localhost ~]$ su - agetest
Password:
You are required to change your password immediately (root enforced)
Changing password for agetest
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
#第一次登陆提示用户修改密码,参考了《鸟哥私房菜》。
本文出自 “石头记” 博客,请务必保留此出处http://stonebox.blog.51cto.com/5409313/1152713
相关文章推荐
- Linux用户和组的操作(八) 修改用户密码 passwd
- linux 查看、修改用户及密码过期时间
- 【每天一个Linux命令】10. 用户账号的新建/修改/删除以及密码修改 useradd/usemod/userdel/passwd
- linux usermod命令参数及用法详解(linux修改用户账号信息命令)
- 【每天一个Linux命令】10. 用户账号的新建/修改/删除以及密码修改 useradd/usemod/userdel/passwd
- Linux 基础操作 (四)————查看用户信息及修改、提权、修改密码
- Rhyme/ Linux chage用户密码状态修改命令
- linux usermod命令参数及用法详解(linux修改用户账号信息命令
- 【Linux】Linux/Ubuntu系统-用户账号的新建/修改/删除以及密码修改 useradd/usemod/userdel/passwd
- 【每天一个Linux命令】10. 用户账号的新建/修改/删除以及密码修改 useradd/usemod/userdel/passwd
- Linux学习日记 —— 7.3.2 用户和用户组管理-用户组管理命令-修改用户密码passwd
- Linux下修改Mysql的用户(root)的密码
- MySQL中新建用户,新建数据库,用户授权,删除用户,修改密码的相关操作
- ORACLE 查看用户密码修改时间
- Linux下修改Mysql的用户(root)的密码
- linux date命令参数及用法详解(linux查看修改系统时间)
- linux忘记root密码,可以进入单用户模式修改密码
- linux 查看用户上次修改密码的日期
- Linux数据库:MySQL新建用户,授权,删除用户,修改密码
- 修改 Linux root 用户密码