Root Password

Reset the ESXi Root Password

Gparted LiveCD

https://sourceforge.net/projects/gparted/files/gparted-live-stable/

 Insert the bootable Live CD, make sure your server can boot off CD/DVD or USB and power it up

 Locate the 2 partitions sized 250MB. As mentioned, /dev/sda5 is what we’re after assuming you installed ESXi on the first available disk. This may differ if, for instance, you installed ESXi on a USB device.

terminals - root prevails

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

ls -l

# vi shadow

root:56wkjhdifs/7654.ggsffdfdf/e4wi.Fugv6/tY554aaarvy2.:17220:0:99999:7::: # [remove yaloo line]

root::17220:0:99999:7:::

cd ..

tar -cf local.tgz etc/

tar -cf state.tgz local.tgz

mv state.tgz /boot

umount /boot

reboot

                            ---------------------------------X----------------------------------------------------

Forgetting passwords is something that unfortunately happens to everyone. Here is two solutions for Exsi password reset, Commands used in the second solution : 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 vi shadow "delete key" cd .. tar -cf local.tgz etc/ tar -cf state.tgz local.tgz mv state.tgz /boot umount /boot reboot

              ----------------------------------------------

Ubuntu Live CD download

http://www.ubuntu.com/download/desktop

GParted

hypervisor/system image is located on the first 250 MB partition (/dev/sda5) which contains the state.tgz file.

close GParted and open the Terminal -  terminals - root prevails

sudo -s

mount /dev/sda5 /mnt

cd /mnt

ls

cp state.tgz /tmp

cd /tmp

tar xzf state.tgz

ls

tar xzf local.tgz

ls

Go to the /etc directory and you can gain access to the shadow file which contains the password hash of ESXi root account.

cd etc

ls

vi shadow

root:$1$1wX62qTk$dgXJsh1PRKZnWyx6aDx3..:15831:0:99999:7:::          # [removed the password hash]

root::15831:0:99999:7:::

: wq

Run the vi shadow command to open the shadow file in the vi editor.

Once you have removed the password hash, press ESC to return to the command mode. Type in :wq and press Enter. This will save your changes and exit

cd ..

tar czf local.tgz etc

tar czf state.tgz local.tgz

cp state.tgz /mnt/

umount /mnt

type reboot then remove the live CD and wait for ESXi server to restart. After a while, you'll get the following screen where you can configure the system by pressing F2.

the password field blank and you can log into the root account

################################################################################################

VMware : How to reset ESXi root password?

Lost your root password? Well, this is very unfortunate! This tutorial will show you how to reset ESXi root password.

You need a Linux Live or Rescue CD to perform this action. You can use RHEL/CentOS using the rescue mode, SysRescue CD, Knoppix or your favorite portable Linux distro.

1. Boot on your Live CD

2. Create two temp folders under /mnt :

Shell

1

2

mkdir /mnt/sda5

mkdir /mnt/sda6

3. Mount the dual root ESXi system partitions into the folders you just created :

Shell

1

2

mount /dev/sda5 /mnt/sda5

mount /dev/sda6 /mnt/sda6

Now, move in the first volume (sda5) :

Shell

1

cd /mnt/sda5

4. Create a safety copy first of the file you are about to edit :

Shell

1

cp -p state.tgz state.tgz.bak

5. Untar state.tgz archive :

Shell

1

tar xzf state.tgz

(This will extract local.tgz)

6. Untar local.tgz archive :

Shell

1

tar xzf local.tgz

(This will extract ‘etc’ folder. You might get some outputs during the extraction about permissions, it’s safe to ignore.)

7. Edit ‘shadow’ file (this is the file where the user passwords are stored, encrypted of course) :

Shell

1

vi etc/shadow

8. At the top line, you should see “root:” followed with alpha numeric characters, which is the encrypted password. Simply erase everything after ” : ” and enter the following :

Shell

1

$1$1wX62qTk$dgXJsh1PRKZnWyx6aDx3..:15831:0:99999:7:::

This line will set the password to “recoverypassword”. You can also create your own by creating a new user on your rescue CD and paste the generated password.

9. Save and exit. Then repack the ‘etc’ folder :

Shell

1

tar czf local.tgz etc

And repack to ‘state.tgz’ :

Shell

1

tar czf state.tgz local.tgz

10. Go back to ‘/mnt’ location and unmount the ‘sda5’ filesystem :

Shell

1

2

cd ../

umount /mnt/sda5

11. Repeat the exact same steps for ‘sda6’, then reboot.

#####################################################################################