How to Reset the VMware ESXi Root Password: Supported Methods and Steps

Sunucun 5 min read

Short answer: A forgotten ESXi root password can’t be recovered, only replaced with a new one. The methods Broadcom (VMware) supports are: changing it with a Host Profile or PowerCLI if the host is connected to vCenter, changing it with another administrator account if you have one, and otherwise reinstalling ESXi while preserving the datastore (VMFS). The widely shared Live USB method of editing the shadow file is unofficial and often doesn’t work on newer releases.

Illustration: VMware

Which Method Fits Your Situation?

Your situationMethodRequirement
You have another local user with administrator rightsChange the root password in the Host ClientThat user’s password
The host is joined to Active DirectoryLog in with an administrator AD account and change itMembership of an AD group with administrator rights on ESXi
The host is connected to vCenterPowerCLI or Host ProfilevCenter access; Enterprise Plus licence for Host Profiles
Standalone host, no other accountReinstall ESXi while preserving VMFSConsole access (physical or iDRAC/iLO) and an installer ISO of the same version

1. With Another Administrator Account

If ESXi has another local user with the Administrator role, or an Active Directory account with administrator rights, this is the easiest route. Log in to the Host Client at https://esxi-ip/ui with that account, select the root user under Manage > Security & users > Users and set a new password with Edit user.

2. With PowerCLI on a Host Connected to vCenter

If the host shows as “Connected” in vCenter, you can change the root password by sending an ESXCLI command through vCenter (Broadcom KB 376979). After connecting to vCenter with PowerCLI in PowerShell:

$creds = Get-Credential -UserName "root" -Message "root and new password"
$esxiserver = Get-VMHost -Name "ESXI_NAME"
$esxcli = Get-EsxCli -VMHost $esxiserver -V2
$userarg = $esxcli.system.account.set.CreateArgs()
$userarg.id = $creds.UserName
$userarg.password = $creds.GetNetworkCredential().Password
$userarg.passwordconfirmation = $creds.GetNetworkCredential().Password
$esxcli.system.account.set.Invoke($userarg)

It returns true on success. The new password must meet ESXi’s complexity rules. On ESXi 8, if shell access for the vpxuser account is disabled, this method fails with “Only users with shell access can make these changes”; in that case use the Host Profile method.

3. With a Host Profile on a Host Connected to vCenter

This requires a vSphere Enterprise Plus licence (Broadcom KB 323617). In summary:

  1. In the vSphere Client, go to Policies and Profiles > Host Profiles and extract a new profile from the affected host (Extract profile from a host).
  2. Edit the profile; clear all check boxes, select only the root setting under Security and services > Security settings > Security > User configuration and enter the new password with Fixed password configuration.
  3. Attach the profile to the host (Attach/Detach Hosts and Clusters), check it first with Check Host Profile Compliance, then apply Remediate. No reboot is needed; untick automatic reboot.
  4. Check compliance again and delete the temporary profile.

4. On a Standalone Host: Reinstall While Preserving VMFS

If the host isn’t connected to vCenter and you have no other account, the only method Broadcom supports is reinstalling ESXi. Your virtual machines live on the datastore (VMFS), so with the right choice they aren’t lost:

  1. Get the installer ISO of the same ESXi version and boot the server from it (USB or iDRAC/iLO virtual media).
  2. Select the disk where ESXi is installed. When the installer detects the existing installation, choose “Install ESXi, preserve VMFS datastore”. The “overwrite” option erases the datastore.
  3. Set the new root password during installation, reboot and redo the network settings (IP, VLAN, DNS) in the DCUI.
  4. Check in the Host Client under Storage that the datastore is visible; in the datastore browser, right-click each VM’s .vmx file and use Register VM.
  5. Reconfigure host settings such as virtual switches (vSwitch), port groups, NTP and the licence.

That’s why regularly backing up the ESXi configuration makes life much easier: with a backup, settings can be restored after a reinstall. For the ESXi installation steps, see our VMware setup guide.

About the Live USB Shadow File Method

The method often described online is to boot the server from a Linux Live USB, open the state.tgz archive on the ESXi boot partition, delete the password hash on the root line of etc/shadow inside local.tgz, and repack the archive. This method:

  • Isn’t supported by Broadcom; a mistake when repacking can leave the server unable to boot.
  • Usually doesn’t work on servers with a TPM, because ESXi 7.0 Update 2 and later encrypt the configuration.
  • Is hard to get right, since the partition layout differs between versions.

It’s only worth considering on an old test server, with a full backup of the ESXi disk. On production servers, use the supported methods above.

How to Avoid This Next Time

  • Keep the root password in a password manager (a corporate vault).
  • Create a second local user with the Administrator role.
  • Back up the ESXi configuration regularly.
  • If you have several hosts, manage them with vCenter so passwords can be changed centrally.

Frequently Asked Questions

Is there a way to find out the old root password?

No. Broadcom states that there is no tool or method to recover a lost original root password; all you can do is set a new one.

Will reinstalling delete my virtual machines?

If you choose “preserve VMFS datastore”, the datastore and the virtual machines on it are kept; you only need to register them again. Still, take a backup first if you can.

Where can I learn the basics of ESXi?

See our what is VMware ESXi and virtual server setup on ESXi articles. If you’d like a ready-made virtual server without dealing with hardware and the virtualisation layer, our VDS server plans are another option.

Categories

Latest guides