Hello DP users, Hope this little tutorial on how to reset ESXi root password helps!!! 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!!! I 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. 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 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
I'm planning to test few VMware for cryptomining. Will there be a possibility to lose the data if any step goes wrong? Nice article.
HELLO! PLEASE FIX YOUR POST AS WE MADE A MISTEAK CAUSE OF IT see you wrot after the extrectiong - > cd /etc and its not good!! as it making you go inside the LiveCD /etc make all changes there and then overiting esxi /etc with Livecd /etc!! the right step would be - cd etc with no / !!! PLEASE FIX IT! we have managed to fix this misteak by doing this steps- > its a command taypo issue - if you notice after extracting etc to root you did the command "cd /etc" instead of "cd etc" and as a result you copied the livecd /etc instead of the real esxi etc file and run over it! the solution : we had installed a new esxi 5.5 and started to copy what we did had left. so you need to do this steps : make new esxi 5.5 go to etc there and make your own etc file - that means that yull see there more files then you need. make sure you have only this : checkconfig.db dhclient-vm0.leases hosts keymap random-seed resolve.conf security(file) sfcb(file) shadow ssh(file) vmsyslog.conf vmsyslog.conf.d(file) vmware(file) all other files you can remove. now you have to find the file onestage.tgz when you have livecd on mount all the disks that you see at fdisk -l ( the ones that you can mount , the vmfs you cant mount and it will apper as unknown" mount everything : mkdir /mnt/sda2 mount /dev/sda2 /mnt/sda2 mkdir /mnt/sda3 mount /dev/sda3 /mnt/sda3 mkdir /mnt/sda4 mount /dev/sda4 /mnt/sda4 mkdir /mnt/sda5 mount /dev/sda5 /mnt/sda5 and so on... and there you should have (dig in the files good!) a file name one(somthing).tgz im sorry i cant remmber the file name! but i think it onestage.tgz or somthing like that. take this file cp to root and extract - then, it will have /etc/ and /var/ inside of it - only part of /etc/ but it will help you to fill up the files that you took from the new esxi 5.5 machine . checkconfig.db -dont touch anything dhclient-vm0.leases- you need to reconfigure the network you shuld have this info on onestage -> vmware file - esx.conf go inside and dig a little. hosts - should have this at onestage.tgz keymap- dont touch anything random-seed - dont touch anything resolve.conf-should have this at onestage.tgz security(file)- search here for the UUID file and change to the UUID as you have it in onestage.tgz , you should have a uuid file there to. sfcb(file)-search here for the UUID file and change to the UUID as you have it in onestage.tgz , you should have a uuid file there to - iwort it twice as i dont remmber in which file it was ! shadow -> delete the string at the root user , thats why we have this all issue so dont forget! ssh(file)-dont touch anything vmsyslog.conf-dont touch anything vmsyslog.conf.d(file) vmware(file)- should have this at onestage.tgz just copy the esx.conf from onwstage to here it has all your privies configuration and after all that- rsync the new etc file to the LiveCd from the new esxi 5.5 with only the relevent files i wrote tar -czvf local.tgz etc tar -czvf state.tgz local.tgz cp state.tgz /mnt/sda5/state.tgz umount /mnt/sda5 reboot Hope you will make it!!