1. 问题的出现

正常部署完VMWARE的VCSA后,如果没有修改root密码策略或者root密码没有定期修改,时间长了在登录管理页面时也会报如下错误。

esxi虚拟机许可证密钥已过期 esxi6.7许可证密钥到期_bash

出现上面的错误后不处置,在升级VCSA6.7时,也会提示如下报错,报错内容也是root密码过期了,导致无法进行正常的升级

Appliance (OS) root password expired.

Please change appliance (OS) root password before attempting an update

2. 解决办法

2.1 开启ssh、bash shell登录权限

打开VCSA控制台,选择Troubleshooting Mode Options,开启ssh、bash shell

esxi虚拟机许可证密钥已过期 esxi6.7许可证密钥到期_ssh_02

esxi虚拟机许可证密钥已过期 esxi6.7许可证密钥到期_esxi虚拟机许可证密钥已过期_03

注意此处两项都回车选择一下,看到Disable就表示当前已是开启状态,无需保存,即时生效

esxi虚拟机许可证密钥已过期 esxi6.7许可证密钥到期_ssh_04

esxi虚拟机许可证密钥已过期 esxi6.7许可证密钥到期_linux_05

2.2 修改root账号密码及策略

通过SecureCRT 或者 xshell等ssh终端工具软件连接VCSA67,默认端口22,直接用root账号 和 原始密码可以登录进去:一种情况会直接提示要求修改密码,按照提示提示完成新密码的设置即可;还有一种情况会不提示更新密码,登录进去需手动输入passwd命令进行修改,下面是第二种情况的修改过程:

#### 然后通过SecureCRT 或者 xshell等ssh终端工具软件连接VCSA67,默认端口22,直接填写root 和 老密码登录进去。
#### 有时也登录后会看到修改密码的提示,先输入老的密码,再输入新的密码,如果没提示就用下面的命令修改root密码
VMware vCenter Server Appliance 6.7.0.41000
 
Type: vCenter Server with an embedded Platform Services Controller
 
Connected to service
 
    * List APIs: "help api list"
    * List Plugins: "help pi list"
    * Launch BASH: "shell"
Command> shell
Shell access is granted to root
 
########################################################################################
## 基本用法
1 chage -M -1 -E -1 root    # 设置root用户的密码永不过期,命令中两个参数是数字1不是小写字母l;
2 chage -l root             # 查看root用户的信息;
########################################################################################
 
 
root@vcsa-ip250 [ <sub> ]# chage -help
Usage: chage [options] LOGIN
 
Options:
  -d, --lastday LAST_DAY        set date of last password change to LAST_DAY
  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -h, --help                    display this help message and exit
  -I, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --list                    show account aging information
  -m, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -M, --maxdays MAX_DAYS        set maximum number of days before password
                                change to MAX_DAYS
  -R, --root CHROOT_DIR         directory to chroot into
  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
 
##  直接修改root 密码永久有效会报错,因为密码已经过期了
root@vcsa-ip250 [ </sub> ]# chage -I -1 -m 0 -M 99999 -E -1 root
You are required to change your password immediately (root enforced)
chage: PAM: Authentication token is no longer valid; new one required
 
## 命令方式修改root密码
root@vcsa-ip250 [ <sub> ]# passwd root
New password:                   #注意新的密码不能和老的密码相似度太高,也不能太简单,否则修改不了,
Retype new password: 
passwd: password updated successfully
 
## 最后执行chage命令,将root密码设置永不过期。
root@vcsa-ip250 [ </sub> ]# chage -I -1 -m 0 -M 99999 -E -1 root
root@vcsa-ip250 [ ~ ]#
 
## 查看修改后的账号过期等信息
root@vcsa-ip250 [ ~ ]# chage -l root
Last password change                                    : May 21, 2022
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@vcsa-ip250 [ ~ ]#

2.3 恢复远程登录权限并登录验证

设置完成后,记得关闭Shell、SSH登录权限,确保系统的安全

esxi虚拟机许可证密钥已过期 esxi6.7许可证密钥到期_ssh_06

此时再执行VCSA升级操作或者用root账户登录管理页面都不会报错了,也不会再提示这类密码过期了。