Resetting an ESXi root password

18,686

Solution 1

For ESXi, the only supported method to change the password is to reinstall.

Reinstalling the ESXi host is the only supported way to reset a password on ESXi. Any other method may lead to a host failure or an unsupported configuration due to the complex nature of the ESXi architecture. ESXi does not have a service console and as such traditional Linux methods of resetting a password, such as single-user mode do not apply.

If you have two hosts and they have the resources to support it, you could vMotion (and/or storage vMotion) the servers all onto a single host, remove and rebuild the empty host, add it back into the cluster. Then move all the guests onto the rebuilt host and remove/rebuild the remaining host. This would allow you to rebuild without incurring any downtime on the guests. Depending on your infrastructure and depending on the number of virtual machines to move, the two hosts should take less than a day to rebuild unless you have extraordinarily large or complex host configuration.

Also, if you are on an older version of ESXi, this would also be a good time to check your current hardware against the HCL and move up to the latest version if supported (After upgrading your vCenter server first of course).

Regarding non-supported methods that I will mention but don't necessarily advise.

  • Use vCenter to join each host to an AD Domain and setup and configure an AD user as an admin to the host and allow AD authentication. Use the vSphere client to connect directly to the host using AD credentials to login. Once connected this way, you should be able to change the password for the root account through the vSphere client connected directly to the host. I've used this in a pinch and it does work.
  • Generate a host profile that specifies the password and attach it to the host. This can be done but still requires the host to be put into maintenance mode. Haven't used this method myself personally.

Solution 2

There are methods to reset an ESXi host's root password, provided you have physical or out-of-band access to the server.

  • I've done this with Host Profiles by reapplying the profile gleaned from another host to the affected server. But you likely don't have the licensing to support this.
  • I've also have to use the boot CD/Live CD approach (also here), which assumes some Linux knowledge and involves setting an empty password or a known encrypted password in the shadow file.

As to how this can happen... Poor documentation, evil terminated administrators, a data center technician who left CAPS-LOCK on when building the servers, my bad memory, etc, :)

Solution 3

The ESXi root password is encrypted and stored in a file named /ect/shadow. Just as this article explains you can remove the root password with the following steps:

  1. Boot your server from Ubuntu Live CD.
  2. Unpack the state.tgz and then local.tgz, delete the password hash inside the shadow file, and re-pack the archive.
  3. After that you can log on ESXi host as the root account without a password.
Share:
18,686

Related videos on Youtube

Daniel Goldberg
Author by

Daniel Goldberg

I play around with computers, mainly Windows.

Updated on September 18, 2022

Comments

  • Daniel Goldberg
    Daniel Goldberg over 1 year

    I've just inherited a very simple VM setup with a pair of ESXi servers clustered and everything is pretty much hooked up. Problem is I do not have the root passwords for the servers and no one has any idea what they are (password guessing has been tried).

    From my understanding, ESXi does not have a single-user mode or anything equivalent. What are my options short of backing up the VMs and nuking the site?

    • joeqwerty
      joeqwerty about 10 years
      I know that you just inherited this and the loss/absence of the root password is not your fault, but WOW! How does that happen?
  • Rex
    Rex about 10 years
    I never said there wasn't other methods - only that the only officially supported method for ESXi is to reinstall. :) I haven't seen the BootCD approach before but have seen the host profiles method before. I also added an additional method in my answer below that I have used before. The licensing with host profiles can be worked around as well - grab a trial license key and apply it for the duration as needed and then reapply your full key after you are done.
  • Daniel Goldberg
    Daniel Goldberg about 10 years
    I added the other answer as the "official" one but this is actually going to help me out if the bosses sign off on this. Thank you.
  • ewwhite
    ewwhite about 10 years
    @DanielGoldberg You're welcome.
  • Rob Moir
    Rob Moir over 9 years
    -1 This adds nothing that isn't already covered by the two 8-month old answers already here.
  • tacos_tacos_tacos
    tacos_tacos_tacos almost 9 years
    @RobM strongly disagree, and so does Google. None of the existing answers provide explicit instructions and this does. Google' own machine learning algorithm has chosen this answer above the others to address the question posed by the query "reset esxi root password" (no quotes)