How to Reset ESXi 6.0 Root Password: A Complete Step-by-Step Guide

·

4 min read

As a system administrator, losing access to your ESXi host due to a forgotten root password can be stressful. Fortunately, there's a reliable method to reset the root password on ESXi versions 6.0 through 6.7. In this guide, I'll walk you through the complete process of resetting your standalone ESXi server’s root password using a Linux live boot USB.

Note: Tested all this on a test server not on a production server.

Prerequisites

Before we begin, you'll need:

  • A USB drive (4GB or larger)

  • Ubuntu 20.04 LTS or any Linux distribution with live boot capability

  • Physical access to the ESXi server

  • Basic familiarity with Linux command line

The Reset Process

1. Prepare Your Environment

First, we need to boot into a Linux environment:

  1. Create a bootable USB drive with Ubuntu 20.04 LTS or your preferred Linux distribution

  2. Connect the USB drive to your ESXi server

  3. Boot the server into the boot menu and select your USB drive

  4. Choose the "Live Boot" option when prompted

2. Locate the ESXi System Partition

Once you're in the Linux environment, we'll need to find and mount the correct ESXi partition:

  1. Open a terminal and switch to root user:
sudo su
  1. Look for the ESXi system partition (typically around 8224 bytes):
fdisk -l | grep /dev/sda

The system partition is usually identified as /dev/sda5, but this might vary on your system. Make note of the correct partition name for your setup.

3. Create Mount Points and Access System Files

Now we'll create the necessary directories and mount the partition:

  1. Create required directories:
cd /
mkdir /mnt/sda5
mkdir /temp
  1. Mount the ESXi partition:
mount /dev/sda5 /mnt/sda5

4. Extract and Modify System Files

This is where we'll access and modify the password information:

  1. Navigate to the mounted partition and extract the state file:
cd /mnt/sda5
tar -xf state.tgz -C /temp
  1. Move to the temp directory and handle the local archive:
cd /temp
tar -xf local.tgz
rm local.tgz    # Remove to avoid confusion later

5. Reset the Root Password

  1. Edit the shadow file:
cd etc
vi shadow
  1. In the shadow file, locate the root user entry and remove the password hash (the string between the first and second colons).

6. Rebuild and Replace System Files

After modifying the shadow file, we need to repackage everything:

  1. Return to the temp directory and create new archives:
cd ..
tar -czf local.tgz etc
tar -czf state.tgz local.tgz
  1. Move the new state file back to its original location:
mv state.tgz /mnt/sda5/

7. Finish Up and Reboot

  1. Unmount the partition:
umount /mnt/sda5/
  1. Reboot the server:
sudo reboot

After the Reset

Once your server reboots, you can log in to the ESXi host using the root username with an empty password. For security reasons, you should immediately set a new strong password for the root account.

Important Notes

  • This procedure works only on ESXi versions 6.0 through 6.7

  • Always backup important data before performing system-level operations

  • If you're managing multiple ESXi hosts, consider using vCenter Server for centralized password management

  • Document your new root password in a secure password manager to avoid future resets

Troubleshooting

If you encounter issues during this process, verify that:

  • You've correctly identified the ESXi system partition

  • All file permissions remain unchanged during the extraction and compression process

  • The server can boot from USB devices

  • The Linux distribution you're using has all necessary tools installed

Security Considerations

Remember that physical access to an ESXi host represents a significant security risk. After performing this password reset:

  • Implement strong physical security measures

  • Consider enabling TPM/secure boot if available

  • Review and update your ESXi host's security settings

  • Document any changes in your system security documentation

Following these steps should successfully reset your ESXi root password. Always ensure you're following your organization's security policies and maintaining proper documentation when performing system-level changes like this.