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.
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.
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“.
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
You can now reset the password on CentOS 8 using the following command.
/# passwd root
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
To make changes to CentOS 8, enter the exit and reboot commands.
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).
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.
Also, you can check our Linux VPS service price and plans through the below link:
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.