How to Reset the Root Password on AlmaLinux VPS (ESXi Environment)

If you or a customer has forgotten the root password for an AlmaLinux VPS hosted on an ESXi environment, don’t worry. This step-by-step guide walks you through the secure method of resetting the root password using the GRUB bootloader and single-user mode. Whether you’re a system administrator or managing virtual environments for clients, this tutorial will get you back into the system with minimal downtime.

Prerequisites:

  • Access to the ESXi console via vSphere Client or ESXi Host Client
  • Permission to power off/on and edit GRUB settings

Step-by-Step Guide to Reset AlmaLinux Root Password on ESXi

Step 1: Access the VM Console

  • Log into your ESXi host or vCenter.
  • Locate the AlmaLinux VM.
  • Click Console and then Launch Console.

Step 2: Reboot the VM

  • If the VM is running, reboot it.
  • If powered off, turn it on.

Step 3: Interrupt GRUB Boot

  • As soon as the GRUB menu appears, quickly press e to edit the boot parameters.
Step-by-Step Guide to Reset AlmaLinux Root Password on ESXi

Step 4: Modify GRUB Parameters

  • Find the line starting with linux or linux16.
  • Use arrow keys to go to the end of that line.
  • Replace the parameters rhgb quiet with:init=/bin/bash

Example:

linux ($root)/vmlinuz-... root=... init=/bin/bash
  • Press Ctrl + X or F10 to boot with the modified settings.

Step 5: Remount Root Filesystem

Once in the shell prompt:

mount -o remount,rw /

Step 6: Change the Root Password

passwd
  • Enter and confirm the new root password.
  • You may see warnings like Failed to connect to bus. These are harmless and can be ignored.
Reset root Pass of AlmaLinux

Step 7: (Optional) Relabel SELinux Context

touch /.autorelabel

This ensures SELinux applies correct labels after reboot.

Step 8: Reboot the VM

exec /sbin/init

or simply:

reboot

Conclusion

You have now successfully reset the root password on an AlmaLinux VPS hosted on ESXi. This method is quick, secure, and requires no external tools. It’s a must-know procedure for any Linux system administrator managing virtualized environments.

If you found this guide helpful, feel free to share it. For more server management tips, check out our blog at eHostingServer!

Leave a Reply

Your email address will not be published. Required fields are marked *