关联问题:密码到期,确保当前密码正确的情况下,修改提示权限不足
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user ump.
Changing password for ump.
Current password:
New password:
Retype new password:
passwd: Authentication token manipulation error
在日常的项目维护中,可以通过chage命令处理
chage的参数包括
-m 密码可更改的最小天数。为零时代表任何时候都可以更改密码。
-M 密码保持有效的最大天数。
-W 用户密码到期前,提前收到警告信息的天数。
-E 帐号到期的日期。过了这天,此帐号将不可用。
-d 上一次更改的日期
-i 停滞时期。如果一个密码已过期这些天,那么此帐号将不可用。
-l 例出当前的设置。由非特权用户来确定他们的密码或帐号何时过期。
-l 参数查看opsuser账号当前设置
[root@localhost ~] /]# chage -l opsuser
Last password change : Aug 28, 2015
含义:【最近一次修改密码的时间】
Password expires : Nov 26, 2015
含义:【密码过期时间】
Password inactive : never
含义:【密码失效时间】
Account expires : Jan 31, 1970
含义:【账户过期时间】
Minimum number of days between password change : 0
含义:【两次改变密码之间相距最小天数】
Maximum number of days between password change : 90
含义:【两次密码改变密码相距最大天数】
Number of days of warning before password expires : 15
含义:【密码过期前开始警告的天数】
修改opsuser密码时间的有效期为300天
[root@localhost ~] /]# passwd -x 300 opsuser
修改opsuser用户过期时间
[root@localhost ~]# chage -E 60 opsuser
需要注意
1、如果提示权限不足,请使用root用户操作或 sudo权限用户操作
2、如果提示无文件操作权限,请放开如下文件只读权限
[root@localhost ~]# sudo chattr -i /etc/passwd
[root@localhost ~]# sudo chattr -i /etc/shadow
[root@localhost ~]# sudo chattr -i /etc/group
[root@localhost ~]# sudo chattr -i /etc/gshadow