How to Reset Your Root Password in AlmaLinux 9

Introduction

This article will teach you how to reset a forgotten root password from the GRUB menu if you are running AlmaLinux 9.

Please note that if you are running AlmaLinux 8, the instructions differ a bit, and we have a separate guide here: How to Reset Your Root Password in AlmaLinux 8

Instructions


First, login to GleSYS Cloud and navigate to the virtual machine in question.

The next step is to reboot the server. You can do that by clicking Reboot in the dropdown menu called Actions or by opening a Console from the same place and pressing Ctrl-Alt-Del in the console view.

Picture below: When rebooting, the GRUB menu will appear, and to edit the boot parameters, step down with the arrow key to AlmaLinux (0-rescue-...) 9.0 (Emerald Puma) and press the key 'e.'


reset-root-password-almalinux-9--grub-menu


Picture below: This is your current boot parameters. Step down to the second last text line starting with 'linux' and delete ro no_timer_check.


reset-root-password-almalinux-9--current-boot-parameters


Picture below: You replace this with rw init=/sysroot/bin/sh. Then press Ctrl-x to boot up the server.


reset-root-password-almalinux-9--new-boot-parameters


Picture below: When the screen with Press Enter for maintenance appears, you hit Enter.


reset-root-password-almalinux-9--press-enter-for-maintenance


To set a new root password, run the following commands:

:/root# chroot /sysroot
:/# passwd
Output
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Finally, run the following commands to reboot the server:

:/# touch /.autorelabel
:/# exit
:/root# reboot

Be prepared that the auto-relabel process can take some time to complete. Then, when the server has booted again, you log in with your new root password!

Hittar du inte det du söker?

Kontakta oss gärna för mer information. Vi hjälper dig att komma fram till den bästa lösningen för dina behov.

Skicka e-post Ring 0200-23 88 00