Support Centre

How to reset a forgotten ESXi 6.x root password

You can perform this kind of reset using a live CD. Any Linux distribution will do as long as it has partitioning tools and a terminal with root access. The one I used was a Ubuntu live CD. It's quite easy to follow.

  • Mount the live CD and boot from it
  • Once booted, open gparted. Or you can use commands from your partition manager in the terminal to list all partitions. Once you see the list, there should be two 250MB partitions. Look for /dev/sda5. It's usually this one if ESXi is installed on the first disk.

1-1.png

  • Open a terminal and enter these commands in the exact order. This may differ depending on the distribution you used to boot from.

sudo su

mkdir /boot /temp

mount /dev/sda5 /mnt

cd /mnt

cp state.tgz /temp

cd /temp

tar -xf state.tgz

tar -xf local.tgz

rm *.tgz

cd etc

  • At this point, you should be inside the etc folder. Open the file named shadow with the text editor of your choice. In this example, we'll use vi.

1-2.png

  • You'll need to delete the password hash. Yours will look different from this example. Just delete that part and save the file. It should now look exactly like the image below.

1-5.png

  • Now we'll need to put the edited file back into its original archive. Just enter the commands in the exact order below.

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

  • Once done, you'll need to reboot the system and boot back into your ESXi server.

1-4.png

  • Once you're booted, just press F2 and enter a blank password for the root account. You should now be able to set another password. Make sure to save it this time and don't enter any special characters (!=_*) at the beginning of the password.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.