Skip to main content

% ins3cure.com

RHEL8 root password recovery

When studying to apply for a Redhat certification I tend to go over root password recovery again. Just in case ๐Ÿ˜„

A normal installation of RHEL8 will display the grub menu when booting. When the menu appears on screen press e:

GRUB

Go to the end of the linux line (which is longer than one row) and add rd.break at the end of the line:

GRUB

Press Ctrl+x to boot and wait for the prompt.

GRUB

Now you have to mount (rw mode) the sysroot partition, chroot to it and change the root password:

GRUB

If SELinux is enforcing, this is mandatory

Before rebooting, a file /.autorelabel must be created in the root directory to instruct SELinux to relabel filesystem upon next boot. Then, type exit twice:

GRUB

The boot process will take longer than usual because of relabeling, but you will be able to login with your new root password.

comments powered by Disqus