Reset a Lost ESXi Root Password

By Ahmet Tolga KAYA 6 min read
Reset a Lost ESXi Root Password

Recovering a Lost VMware ESXi Root Password

VMware doesn’t provide a way to recover the original root password on an ESXi host. That’s stated plainly in Broadcom’s own knowledge base: if you’re locked out and the host isn’t managed by vCenter, reinstalling is the only officially supported path. That sounds harsh for a single home lab or branch-office host, which is exactly why a Linux-live-CD trick for clearing the password hash directly on disk has circulated in sysadmin circles for over a decade. It still works — on older ESXi builds. On ESXi 7.0 Update 3 and every 8.x release, VMware encrypted the configuration archive that trick relies on, and the plain version of it no longer does anything.

This covers both: the official recovery paths worth trying first, the classic method for hosts still running an older ESXi build, and what actually changed on newer versions so you’re not following a decade-old guide against a host it was never written for.

How do you reset a lost ESXi root password?

If the host is managed by vCenter with an Enterprise Plus license, reset it through Host Profiles or PowerCLI without touching the host directly. If it’s standalone, VMware’s only supported option is reinstalling ESXi while preserving the VMFS datastore, which keeps your VM files intact even though the host configuration is rebuilt. An unsupported but widely used alternative exists for standalone hosts: boot a Linux live environment, mount the ESXi boot partition, and clear the password hash in /etc/shadow. This works cleanly on ESXi 5.x through roughly 7.0 Update 2. On ESXi 7.0 U3 and 8.x, the configuration archive is encrypted, and the same steps won’t get you in.

Try the supported path first

Before booting anything from a USB stick, check which of these applies:

  • Host is in vCenter, Enterprise Plus licensed: Extract a Host Profile from a healthy host (or build one), edit the root password field in that profile, and attach it to the locked-out host.
  • Host is in vCenter, no Host Profile license: Reset it with PowerCLI instead — Get-EsxCli against the host object lets you set a new root password without ever logging into the host itself.
  • vSphere Configuration Profiles enabled instead of classic Host Profiles: the same reset is available through Configuration Profiles.
  • Standalone host, no vCenter: reinstall ESXi and reattach the existing VMFS datastore. Back up the host configuration first if you can still reach it (DCUI, SSH) — even a failed login attempt doesn’t mean the configuration export tools are unreachable if you have another admin account or SSH key that still works.

If none of those apply — no vCenter, no other account, no working backup — the live-CD method below is the realistic option, with the caveat that it’s explicitly unsupported and version-dependent.

The classic method (ESXi 5.x through ~7.0 U2)

This is the same approach that’s been documented for years, and it still works on hosts running an ESXi build old enough to predate encrypted configuration archives.

Confirm you’re actually locked out before starting — the DCUI will show Authentication failed / Invalid login or password if the credentials are wrong.

Reset a Lost ESXi Root Password

1. Shut down the host cleanly from the console if you can reach it at all, then power it back on. If you can’t authenticate anywhere, use the physical or remote console power controls to restart it.

2. Boot the host from a Linux desktop live image — Ubuntu Desktop and GParted Live both work; GParted Live is lighter if all you need is the partition tool.

3. Choose Try Ubuntu (or the equivalent “run without installing” option). You’re not installing anything on the host.

Reset a Lost ESXi Root Password

4. Open a terminal from the desktop search or applications menu.

Reset a Lost ESXi Root Password

5. Get root in the terminal with sudo -i, then list the disks with fdisk -l or lsblk to identify the ESXi boot device.

Reset a Lost ESXi Root Password

6. ESXi’s boot partitions are normally GPT, which older fdisk builds won’t parse cleanly. If that happens, open GParted instead to see the partition layout.

7. Mount the correct partition — typically sda5, one of ESXi’s two bootbank partitions — to a temporary directory: mkdir /mnt/esxi && mount /dev/sda5 /mnt/esxi.

8. Copy state.tgz out to a working directory and extract it. This produces local.tgz.

mkdir /tmp/work && cd /tmp/work
cp /mnt/esxi/state.tgz .
tar xzf state.tgz

9. Extract local.tgz in turn. This produces an etc directory containing the host’s configuration files, including shadow.

tar xzf local.tgzCode language: CSS (css)

10. Open etc/shadow in a text editor and find the root line. Delete the characters between the first two colons — that field holds the password hash. Leaving it empty gives root a blank password rather than a random one you’d still be locked out of.

vi etc/shadow

11. Repack etc into local.tgz, then local.tgz into state.tgz, and copy the result back to the mounted partition.

tar czf local.tgz etc
tar czf state.tgz local.tgz
cp state.tgz /mnt/esxi/

12. Unmount the partition, remove the live media so the host boots from local disk, and reboot.

umount /mnt/esxi
reboot

13. Once ESXi finishes booting, log in as root with no password.

Reset a Lost ESXi Root Password

14. Set a real password immediately, and store it somewhere your team can actually retrieve it next time — a password manager or sealed break-glass procedure, not a sticky note on the rack.

Reset a Lost ESXi Root Password

That last step matters more than it sounds. The entire reason this article exists is that someone lost the password once already.

Frequently Asked Questions

Can VMware recover my ESXi root password for me ?

No. There’s no backdoor and no support case that recovers the original password — only ways to set a new one.

Does the shadow-file-edit method work on ESXi 8.0 ?

No, not in its classic plain-tar form. ESXi 7.0 U3 and all 8.x releases encrypt the configuration archive, so there’s no plain etc/shadow to edit after extraction.

What’s the safest option if the host isn’t managed by vCenter ?

Reinstall ESXi and reattach the existing VMFS datastore. Your VM files survive; the host configuration doesn’t, so back it up first if you have any way to reach the host.

Why did my password change disappear after a reboot ?

Most likely you modified only one of ESXi’s two bootbank partitions. The other one still has the old configuration and can overwrite your change during the boot sync.

Can I use this method on a host I don’t own or administer?

No — treat this the same as any other credential-recovery procedure: only use it on infrastructure you’re authorized to manage.

References

Broadcom — Methods to Recover the ESXi Host Root Password https://knowledge.broadcom.com/external/article/393496/methods-to-recover-the-esxi-host-root-pa.html

Broadcom — Reset Password for Root Account of ESXi Server Using PowerCLI https://knowledge.broadcom.com/external/article/376979/reset-password-for-root-account-of-esxi.html

William Lam — Recovering ESXi 7.x & 8.x Host After Forgetting or Losing Root Password https://williamlam.com/2024/10/recovering-esxi-7-x-8-x-host-after-forgetting-or-losing-root-password.html

Learn more: Greyed Out “Migrate” Button Issue in VMware vCenter and Its Solution

Ahmet Tolga KAYA

Systems Engineer and Technical Writer focused on Windows, Microsoft technologies, infrastructure, cybersecurity, automation, and platform reliability.