Reset forgotten vsphere root /esxi password

From roonics
Jump to navigation Jump to search

Tested using vSphere version 5.5.

1. Download Gparted and create a bootable usb or mount the ISO file via the iLO/iDrac.

2. Once in Gparted you need to look for two 250MB paritions, shown below:

3. Open a terminal window and type the following commands:

sudo su
mkdir /boot /temp
mount /dev/sda5 /boot
cd /boot
cp state.tgz /temp
cd /temp
tar -xf state.tgz
tar -xf local.tgz
rm *.tgz
cd etc

4. Now we need to edit the shadow file and remote the password. Use vi or nano to open shadow:

vi shadow

or

 nano shadow

5. You will then see a file similar to below, you want to remove the data between the first two colons for root:

Before:

root:$6$lYBB36Wx$UfYqNo0g&63hdOMRgNoJHFjAMa.s5hhf05nWVHgtus85FkPIzcFV.KJAOgog9NbEu85SmAIF/SaR8VIQb8b1:13358:0:99999:7:::
nobody:*:13358:0:99999:7:::
nfsnobody:!!:13358:0:99999:7:::
dcui:*:13358:0:99999:7:::
daemon:*:13358:0:99999:7:::
vpxuser$$mGF4FrgiwOECIlL$uZjJ2PXuRfIRMveg.GYWC.G3KBsyStFv4.1Q97JU6w3cbpBo3.D3cjiDkk1/XcD/3qjp7q/QOzeBSo94KTVn.:18257:0:99999:7:::

After:

root::13358:0:99999:7:::
nobody:*:13358:0:99999:7:::
nfsnobody:!!:13358:0:99999:7:::
dcui:*:13358:0:99999:7:::
daemon:*:13358:0:99999:7:::
vpxuser:$6$mGF4FrgiwOECIlL$uZjJ2PXuRfIRMveg.GYWC.G3KBsyStFv4.1Q97JU6w3cbpBo3.D3cjiDkk1/XcD/3qjp7q/QOzeBSo94KTVn.:18257:0:99999:7:::

6. Save and exit

7. Now run the following commands:

cd ..
tar -cf local.tgz etc/
tar -cf state.tgz local.tgz
mv state.tgz /boot
umount /boot
reboot

8. Boot back in to Gparted and follow steps 3-7 for the other parition.

9. Once rebooted and back in vSphere DCUI you should be able to log in with username root and a blank password. You can then go in and set the password you require. ‎<comments />