How to recover VMware ESXi root password?


We should not lose the super user account on any operating system especially on VMware ESXi. There may be a chance of losing root password due to system administrator careless or defective keyboard. If you forgot root password of ESXi host, then there is no way to recover it. VMware does not provide utility or methods to recover the original root password of an ESX/ESXi host.  

If you try with some other method may lead to the host failure or unsupported configuration due to complex architecture of ESXi as per VMware KB. Before reinstalling ESXi, you can just try this method as a last option.

In order to recover the root password, you need Ubuntu Desktop operating system DVD.

1. Halt the VMware ESXi server from console (Hardware console whatever you have) since we can’t login to ESXi host to shutdown the server by pressing F12.

2. Boot the server from Ubuntu Desktop DVD. Here i am using Ubuntu Desktop 14.04 since it will work as Live CD.

3. Once the Ubuntu is boot up, it will ask two options. You just select “Try Ubuntu”.

Image

4. From the Ubuntu desktop, click on the search icon and search for terminal and open it.

Image

Double click the terminal icon.

Image

5. Gain root access by using sudo command. Use fdisk command to list the available disks.

Image

6. Normally /dev/sda will be the root disk of VMware Esxi. As per the above screenshot, sda is having GPT partition and it’s not supported in fdisk .Let me try from Gparted utility.

Image

Gparted screen will something like below one.

Image

7. You need to mount /dev/sda5 to recover the VMware ESXi password. You need to identify in terms of size and flag. Once you have mounted, you can see files like the below screen shot.

Image

8. Copy the file “state.tgz” to /tmp. Then untar the state.tgz which will create file called local.tgz.

Image

9. Untar the local.tgz file and it will create a directory called “etc”.

Image

10. Go to the “etc” directory and edit the file called “shadow” using vi editor. You need to remove the strings between first colon to second colon (which will be encrypted password).

Image

11. Here i am updating the “etc” to local.tgz and local.tgz to state.tgz. After updating the tar files, i am copying the updated state.tgz file to /mnt where we have mounted the VMware ESXi root.

Image

12.Un mount the /mnt and reboot it. Please make sure that you need to remove the “Ubuntu Desktop” DVD from the server. So that it can boot from local hard disk.

Image

13. Once the VMware ESXi 5.5 is boot up, just login as root without password.

Image

14. Set new root password from here.

Image

Thats it. Try this method on your own risk because vmware doesn’t take any responsibility if anything bad happens while trying above method.

 

About Alex Hunt

Hi All I am Manish Kumar Jha aka Alex Hunt. I am currently working in VMware Software India Pvt Ltd as Operations System Engineer (vCloud Air Operations). I have around 5 Years of IT experience and have exposure on VMware vSphere, vCloud Director, RHEL and modern data center technologies like Cisco UCS and Cisco Nexus 1000v and NSX. If you find any post informational to you please press like and share it across social media and leave your comments if you want to discuss further on any post. Disclaimer: All the information on this website is published in good faith and for general information purpose only. I don’t make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this blog is strictly at your own risk. The Views and opinions published on this blog are my own and not the opinions of my employer or any of the vendors of the product discussed.
This entry was posted in Vmware. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s