Các bài viết cũ

How to reset ESXi v6 root password when forget password


Disclaimer: VMware doesn’t suggest any other method but to reinstall the ESXi host!!! If you follow this tutorial – I’m not responsible for any/all possible damages!!!
We used this version of ESXi to reset the password:
ESXi ISO image (Includes VMware tools) 2016-03-15 | 6.0U2 |
(VMware ESXi 6.0.0 VMKernel Release Build 3620759)
You will need a physical access to ESXi host in order to be able to reset the password because you cannot shutdown/reboot (F12) without the password.
Download Kali linux distribution, burn it and boot from it:
https://www.kali.org/downloads/ )

ESXi stores passwords in /etc/shadow file and once the machine is down it’s saved in state.tgz So we need to find it. It’s usually either on sda5 or sda6:
root@kali:~# fdisk -l
You should see sda5 and sda6 partitions.
Create the mounting points:
root@kali:~# mkdir /mnt/sda5
root@kali:~# mkdir /mnt/sda6

Mount them:
root@kali:~# mount /dev/sda5 /mnt/sda5
root@kali:~# mount /dev/sda6 /mnt/sda6

Look for state.tgz file
root@kali:~# ls -l /mnt/sda5 | grep state
in my case state.tgz file was on this partition, so I’m skipping sda6
Copy this file to your home folder, extract it and edit the shadow file
root@kali:~# cp /mnt/sda5/state.tgz state.tgz
root@kali:~# gzip -d state.tgz
root@kali:~# tar -xvf state.tar
root@kali:~# gzip -d local.tgz
root@kali:~# tar -xvf local.tar
root@kali:~# cd /etc
root@kali:/etc# vi shadow
 
image

make changes, save, exit and put it back:
root@kali:/etc# cd ..
root@kali:~# tar -czvf local.tgz etc
root@kali:~# tar -czvf state.tgz local.tgz
root@kali:~# cp state.tgz /mnt/sda5/state.tgz
root@kali:~# umount /mnt/sda5
root@kali:~# umount /mnt/sda6

Once you reboot – you should be able to login without a password and set a new one

image

Advertisements
%d bloggers like this: