业务反馈腾讯线上EMR大数据集群机器下hadoop用户定时任务突然都失效了,crontab命令也不能执行,看了报错应该是密码过期被锁了。联系腾讯云技术支持还说他们都是设置的从不过期,甩了几张图打脸后就老实了,最后批量执行 chage -M 99999 hadoop 把集群机器 hadoop 用户密码都设置为永不过期问题解决。
[hadoop@10 ~]$ crontab -l You (hadoop) are not allowed to access to (crontab) because of pam configuration. [root@10 ~]# chage -l hadoop Last password change : Jul 31, 2023 Password expires : Oct 29, 2023 Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 90 Number of days of warning before password expires : 7 # 执行 chage -M 99999 hadoop 设置密码永不过期 [root@10 ~]# chage -l hadoop Last password change : Jul 31, 2023 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 # 如果执行完还是不行,比如出现下边这个情况: [root@10 ~]# chage -l hadoop Last password change : password must be changed Password expires : password must be changed Password inactive : password must be changed 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 # 执行 passwd -d hadoop 然后就好了 [root@10 ~]# passwd -d hadoop Removing password for user hadoop. passwd: Success [root@10 ~]# chage -l hadoop Last password change : Oct 31, 2023 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、使用语法
用法:chage [options] 账户
2、参数说明
参数 | 参数说明 |
---|---|
-d, --lastday LAST_DAY | 将最近一次密码修改时间设为 “LAST_DAY” |
-E, --expiredate EXPIRE_DATE | 将帐户过期时间设为 “EXPIRE_DATE” 0 表示马上过期,-1 表示永不过期 |
-h, --help | 获取命令帮助信息 |
-I, --inactive INACTIVE | 过期 INACTIVE 天数后,设定密码为失效状态 |
-l, --list | 列出用户以及密码的有效期 |
-m, --mindays MIN_DAYS | 将两次改变密码之间相距的最小天数设为 “MIN_DAYS” |
-M, --maxdays MAX_DAYS | 密码保持有效的最大天数 |
-R, --root CHROOT_DIR | chroot 到的目录 |
-W, --warndays WARN_DAYS | 密码过期前,提前收到警告信息的天数 |
参考: