vCenter Server Appliance root password reset without reboot
search cancel

vCenter Server Appliance root password reset without reboot

book

Article ID: 321369

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Reset a lost or forgotten root password for vCenter Server Appliance (VCSA) 6.7 Update 1, 7.x, 8.x and 9.x  without performing a system reboot.

Note: The above symptoms can also occur on an external Platform Services Controller (PSC) running on vSphere 6.5 and 6.7.

Environment

  • VMware vCenter Server Appliance 6.7 U1
  • VMware vCenter Server 7.x
  • VMware vCenter Server 8.x
  • VMware vCenter 9.x

Resolution

  • With the change within VCSA 6.7 U1, the SSO user who is part of SystemConfiguration.BashShellAdministrator group will be able to log in to Bash shell and can call any commands using sudo and without password. This aims at reducing the gap between the root and SSO administrator user. The user has to enable shell to log in to the bash shell. By default, the user will be logged into appliance shell.
  • For passwords that have expired, the default vCenter Server Appliance password expires after 90 days. For more information, see Change the Password and Password Expiration Settings of the Root User.

The resolution has two sections for the problem that we usually encounter:

  1. Steps to reset the Root Password
  2. Steps to follow if you have forgotten the Root Password.

  1. Steps to reset the Root Password in VCSA

    1. Connect SSH to VCSA and login using administrator@vsphere.local where vsphere.local is your default SSO Domain. ​​​​​

    2. If first time logging in, enable shell then enter shell.

      shell.set --enable true
      shell

    3. Once in shell as sso-user, run the below command to change to root shell.

      sudo -i

    4. Unlock the 'root' account using below command if it is already locked due to multiple logins with incorrect password.

      pam_tally2 --user=root --reset



      For 8.0 U2 onwards:

      /usr/sbin/faillock --user root --reset

       Note: pam_tally2 is deprecated in Photon 4, use faillock instead

      1. Then once in root shell, run passwd to change the root password.

        passwd
      2. Login to the vCenter Server Appliance using the new root password.

  2. Steps to follow if you have forgotten the Root Password:

  1. Follow Steps 1 and 2 from Section A.
  2. Then continue by running the following steps: 
    1. Run the following command in bash shell to change the root password.
      sudo passwd root
      New password:
      Retype new password:
      passwd: password updated successfully 
    2. Login to vCenter Server Appliance using the new root password.

      sudo -i
      Password:
      Connected to service

          * List APIs: "help api list"
          * List Plugins: "help pi list"
          * Launch BASH: "shell"

Note: The root password can be set to never expire in order to prevent this issue by running command:

chage -I -1 -m 0 -M 99999 -E -1 root  or at the VAMI  ( https://<vcenter_fqdn>:5480)
If the issue persists, see Unable to log in to the vCenter Server Appliance shell using root account even after password reset

Additional Information

To update the password of the root user in the vCenter Server via appliance shell  if account is not locked

  1. Access the appliance shell and log in as a user who has a super administrator role.
    The default user with a super administrator role is root.
  2. login using administrator@vsphere.local where vsphere.local is your default SSO Domain. ​​​​​
  3. Run the localaccounts.user.password.update --username user name --password command.
    1. localaccounts.user.password.update --username root --password
    2. Enter and confirm the new password when prompted.

More information on Managing vCenter local user accounts: Managing Local User Accounts in vCenter Server.

Managing vCenter password policy: Change the Password and Password Expiration Settings of the Root User

Useful logs for troubleshooting re-lockouts:/var/log/audit/sshinfo.log