reset the password on centos 8

Reset The Password On CentOS 8

Forgetting root Linux passwords is not uncommon for users. This is especially true if you haven’t logged in to the root user for a long time. In this short article, we will teach you how to reset the password on CentOS 8.

How To Reset The Password On CentOS 8

First, reboot or turn on your CentOS 8 system. Select the kernel you want to boot with. Then, press the “e” key on the keyboard to make changes and interrupt the automatic boot process.

press e to stop boot process

On the next screen, as shown below, look for the “ro” (read-only) parameter.

You can use our guide to complete the boot process in Linux.

Find RO to reset the password on centos 8

Replace the “ro” kernel parameter with “rw” and add the init = /sysroot/bin/sh kernel parameter below. As a result, you need to replace the “ro” kernel parameter with “rw init = /sysroot/bin/sh“.

Change RO with RW to reset the password on centos 8

As soon as the changes are completed, press ctrl + x on the keyboard to enter single-user mode. Then, enter the following command to mount the root file system in reading and write mode.

/# chroot /sysroot

enter the singler user mod to reset the password on centos 8

You can now reset the password on CentOS 8 using the following command.

/# passwd root

set the new password

After entering the new password that you have prepared, it will ask you to confirm it again by entering the new password. Choose a strong password that combines uppercase, lowercase, numeric, and special characters.
Then, enter the following command to activate SELinux.

/# touch /.autorelabel

enable the SELinux after reset the password on centos 8

To make changes to CentOS 8, enter the exit and reboot commands.

/# exit 
/# reboot

enter these command to apply the setting

After rebooting the system, the relabelling process will start in SELinux and will take about 3 minutes. (Of course, this operation will not be performed if you disable SELinux).

Relabelling the SELinux process

As soon as the relabelling process is complete, the system will reboot, and after that, you will see the login screen on the screen and you can log in with the root user with the new password you defined.

Login with your new password

Also, you can check our Linux VPS service price and plans through the below link:

https://operavps.com/linux-vps/

In this tutorial, we did reset the password on CentOS 8.
We hope you find this tutorial useful. Don’t forget to share your comments and suggestions with us.

Leave a Reply

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