This article provides steps to change the root password on an ESXi host.
For security reasons, it may be necessary to change the password for the root user on an ESXi host after installation.
Environment
VMware ESXi 6.X VMware ESXi 7.X VMware ESXi 8.X
Resolution
Using the Direct Console User Interface (DCUI)
Connect a monitor and keyboard directly to the ESXi host; or access the remote management interface (iDRAC, iLO, etc).
At the ESXi welcome screen, press F2 to access the System Customization menu.
Log in as the root user with the current password.
Navigate to "Configure Password" in the menu.
Follow the prompts to enter and confirm the new password.
Exit the DCUI after successfully changing the password.
Using the ESXi Shell
Log in to the ESXi host console, either via SSH or the physical console.
Log in as root or acquire root privileges by running the command:
$ su -
Enter the current root password when prompted.
Change the root password by executing:
$ passwd root
Enter the new root password, and press Enter. Enter the password a second time to verify. There may be a warning about being prevented from using bad passwords.
If a mistake was made when typing or retyping the new root password, restart the process. Example:
$ passwd root Changing password for user root. New UNIX password: Retype new UNIX password: Sorry, passwords do not match New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully.