Link to home
Start Free TrialLog in
Avatar of jsctechy
jsctechyFlag for United States of America

asked on

how can i restore a ROOT password for a VMWARE ESXi 4.1 host?

after initially logging into a host, i had to run the vsphere installer, and install the certificate
when vsphere loaded back up, im now unable to login to my ESXi 4.1 host, it seems the password is incorrect? has this happened to anyone before? is this a glitch? how can i change my root password? i see online that i can do this by going through the GRUB menu but, when i restart the ESX host, i dont have the grub menu appear!!!! please help!!!!
Avatar of PERSJWM
PERSJWM
Flag of United States of America image

1. Reboot the ESX host.
 2. When the GRUB screen appears, press the space bar to stop the server from automatically booting into VMware ESX.
3. Use the arrow keys to select Service Console only (troubleshooting mode).
4. Press the a key to modify the kernel arguments (boot options).
5. On the line presented, type a space followed by the word single.
6. Press Enter. The server continues to boot into single-user mode.
7. When presented with a bash prompt such as sh-2.05b#, type the command passwd and press Enter.
8. Follow the prompts to set a new root user password.
9.  When the password is changed successfully, reboot the host using the command reboot and allow VMware ESX to boot normally.
Avatar of jsctechy

ASKER

ok, that pertains to ESX not ESXi, i dont get the GRUB menu when i restart the HOST... is there anyway to get this to show up?
Ahh I misread the version.  My apologies.  Take a look at this:

http://www.bock.nu/blog/reset-root-password-vmware-esxi-4.1
Hello,

 1.   First of all, you need to boot your ESXi server with a Linux live CD. I prefer GRML, but any live CD will do. Of course, you can also boot from a USB stick.
     
 2.   Find the partition containing a file named "state.tgz". For my installation, it was on a VFAT filesystem labelled "Hypervisor3", which is accessible in GRML at "/mnt/Hypervisor3". You might need to mount it manually with the command

    mount /mnt/Hypervisor3
     
 3.   Unpack the "state.tgz" file somewhere. It contains exactly one file, which is another archive named "local.tgz".

    cd /tmp
    tar xzf /mnt/Hypervisor3/state.tgz
     
4.    Unpack the "local.tgz", and find an "etc" directory containing several configuration files.

    tar xzf local.tgz

 5.   Edit the file etc/shadow to change the password.

    vi etc/shadow

6.    Probably the easiest way is to replace the line starting with "root" with the line of another user account of which you know the password. You only need to change the name at the beginning of the line (before the first colon) to "root". You've then set the root password to a password you know.
    Alternatively, you can just remove the hash altogether (everything between the first and the second colon) and login to the service console as root with no password at all.
     
7.    Re-pack the files and move the modified state.tgz back to the VFAT partition. Probably it is a good idea to make a backup copy of the original state.tgz in case something goes wrong:

    mv /mnt/Hypervisor3/state.tgz /mnt/Hypervisor3/state.tgz.bak
    rm local.tgz
    tar czf local.tgz etc
    tar czf state.tgz local.tgz
    mv state.tgz /mnt/Hypervisor3/
     
 8.   Reboot back into ESXi and you're done.
VMware's official stance for pwd change for ESXi is a reinstall. It takes about 7mins (or less) to reinstall ESXi. And, it seems this is a fairly new install so no host configs needed to worry about.

~coolsport00
@jordannet - that link is for ESX, not ESXi; different architectures.
Yes, its happened to us, and also the password does not like certain characters!
sorry i missed the i from ESX , however for esxi .. check this :

http://www.bock.nu/blog/reset-root-password-vmware-esxi-4.1
You've posted the same information a third time that two of us have posted twice already.
@PERSJWM:
Why you are angry?? ok Mr Author , ignore my link which is same of Mr. Persjwm and get here is alternative and simple way to change root password :-p..

http://www.ntpro.nl/blog/archives/1677-An-alternative-way-for-ChangingResetting-an-ESXi-4.1-root-password.html

Mr. Persjwm .. good afternon
Good afternoon to you as well, sir.
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial