VMware : How to reset ESXi root password?

By | May 6, 2013

Lost your root password? Well, this is very unfortunate! This tutorial will show you how to reset ESXi root password.

There is no supported method to “reset” the root password, VMware suggest to boot from ESXi installer disk and select “Install ESXi, preserve VMFS datastore” option. This will overwrite the current installation (fresh install, overwriting all configuration) but preserve the VM stored in the datastore. If you don’t want to lose your configuration and having to re-import all the VMs into the host inventory, the following manual procedure will show you how to really just reset the password.

You need a Linux Live or Rescue CD to perform this action. You can use RHEL/CentOS using the rescue mode, SysRescue CD, Knoppix or your favorite portable Linux distro.

1. Boot on your Live CD

2. Create two temp folders under /mnt :

3. Mount the dual root ESXi system partitions into the folders you just created :

Now, move in the first volume (sda5) :

4. Create a safety copy first of the file you are about to edit :

5. Untar state.tgz archive :

(This will extract local.tgz)

6. Untar local.tgz archive :

(This will extract ‘etc’ folder. You might get some outputs during the extraction about permissions, it’s safe to ignore.)

7. Edit ‘shadow’ file (this is the file where the user passwords are stored, encrypted of course) :

8. At the top line, you should see “root:” followed with alpha numeric¬†characters, which is the encrypted password. Simply erase everything after ” : ” and enter the following :

This line will set the password to “recoverypassword”. You can also create your own by creating a new user on your rescue CD and paste the generated password.

9. Save and exit. Then repack the ‘etc’ folder :

And repack to ‘state.tgz’ :

10. Go back to ‘/mnt’ location and unmount the ‘sda5’ filesystem :

11. Repeat the exact same steps for ‘sda6’, then reboot.