🔐 How to Reset a Forgotten Linux Root Password via ESXi – Complete Guide 2025
Can't access your server with the root password? Don't worry! If your server is running as a virtual machine on VMware ESXi, resetting the root password is fairly simple. Just follow the steps below to regain access.📌 Step 1: Connect to the ESXi Console
Connect to your ESXi host using the vSphere Client or the Web UI. Reboot the virtual machine where you want to reset the password. While the VM is restarting, continuously press the arrow keys to reach the GRUB/kernel boot screen. Once there, press theE key to enter the kernel parameter editing mode.⚠️ This method works the same across most Linux distributions. Simply press E at the kernel selection screen to modify boot parameters.
📌 Step 2: Boot into Rescue Mode
After entering the GRUB edit mode, scroll to the line that includes thero parameter and replace it with:rw init=/sysroot/bin/bashThen, press
CTRL + X to boot the system into recovery mode.📌 Step 3: Reset the Root Password
Once the VM boots into rescue mode, run the following command:
Bash:
chroot /sysroot
Then reset the root password using:
Bash:
passwd root
After successfully setting the new root password, run:
Bash:
touch /.autorelabel
Finally, reboot the virtual machine:
Bash:
reboot
🔐 Your server is now accessible with the new root password. This method allows you to reset the password without any data loss and regain full control of your system.