Resetting root password in vCenter Server Appliance 6.5 / 6.7 / 7.x / 8.x
search cancel

Resetting root password in vCenter Server Appliance 6.5 / 6.7 / 7.x / 8.x

book

Article ID: 322247

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This article provides steps to reset a lost, forgotten, or expired root password for a vCenter Server Appliance (or external PSC) 6.5 and later. 

 
Important: This article is explicitly for the vCenter Server Appliance (and external PSC 6.5 and 6.7) 6.5 and later.



Symptoms:

  • The root account password of VMware vCenter Server Appliance fails
  • The root account of the vCenter Server Appliance 6.5 and above is locked or account is expired
  • The root account password has been lost or forgotten
  • You are unable to login to vCenter
Note: The above symptoms can also occur on an external Platform Services Controller (PSC) running on vSphere versions 6.5 and 6.7.

Environment

  • VMware vCenter Server 8.0.x
  • VMware vCenter Server 7.0.x
  • VMware vCenter Server  6.7.x
  • VMware vCenter Server Appliance 6.5.x

Cause

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

Resolution

Process to Reset the Root Password in VCSA:

Note: 6.7U1 and later have a simpler method to reset the password, see KB 75174

To reset the root password for the vCenter Server Appliance:

  • Take a snapshot or backup of the vCenter Server Appliance before proceeding.
    • Caution: Do not skip this step
    • Note: If the vCenter Appliance is on the same ESXi hosts it manages. Connect directly to the ESXi host that it is located on to perform these steps.
  • Reboot the vCenter Server Appliance.
  • After the VCSA Photon OS starts, press the e key to enter the GNU GRUB Edit Menu.
  • Locate the line that begins with the word Linux.
  • Append these entries to the end of the line -

rw init=/bin/bash

The line should look like the following screenshot:

  • Press F10 to continue booting.
  • Run the command -

mount -o remount,rw / 

  • 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. )

  • In the Command prompt, enter the command passwd and provide a new root password (twice for confirmation):

passwd

  • Unmount the filesystem by running this command (yes, the unmount command is umount  -  it's not a spelling error):

umount / 

  • Reboot the vCenter Server Appliance by running this command:

reboot -f

  • Confirm that you can access the vCenter Server Appliance using the new root password.
  • Remove the snapshot taken initially if applicable.
  • You could set the Root password 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

  • To confirm the changes made and validate the root account details, run the following command from the vCenter SSH session:

root@vc[~]# chage -l root

example:

root@vc [ / ]# chage -l root
Last password change                                    : Aug 20, 2024
Password expires                                        : Nov 18, 2024
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

 

  

 

Additional Information

Additionally, to check the password details for the [email protected] (default SSO) account, run the following command from the vCenter SSH session:

root@vc[~]# chage -l sso-user

example:

                root@vc [ / ]# chage -l sso-user
                Last password change                                    : Feb 14, 2023
                Password expires                                        : May 15, 2023
                Password inactive                                       : May 15, 2023
                Account expires                                         : never
                Minimum number of days between password change          : 1
                Maximum number of days between password change          : 90
                Number of days of warning before password expires       : 7

For 7.0U1 and 6.7U3j there are a few changes:

  1. The Root user will be prompted to reset the password when they try to SSH to the machine if expired or expiring.
  2. You can also log in to VAMI using the SSO administrator and reset the root password from there.
  3. Email notification is sent earlier to prevent from having the Root password expired.
  4. An alarm will be triggered in vsphere-ui to notify the user about the password expiry.

Changes in 8.0 U2 and above versions:

  • You will get the below error while executing pam_tally2 in 8.0 U2 or above versions, as this utility was deprecated in Photon 4 and 8.0 U2 is using Photon 4 version.
  • The alternate utility on Photon 4 is "/usr/sbin/faillock" to unlock the accounts.
  • "-bash: pam_tally2: command not found"

For more information, see -