How to Reset CentOS 8 Root Password?

This is what you need to reset CentOS root password on CentOS 8.x and 7 when you forgot it. To reset CentOS root password you don’t need anything just a simple boot will help you perform the entire process of resetting the lost password of CentOS Linux.

I’m testing this on a virtual machine. It works perfectly and I have reset CentOS Lost password with this method many times at home and work office. So try to not destroy your CentOS Linux server in a real network environment.

Reset CentOS Root Password

Note: This tutorial will only work if you have direct access to the machine or serial terminal access with boot menu options. You can’t reset the root password if you’re remotely connected since you need boot menu access.

1. For the first time when you boot your CentOS system, on the boot loading page, select the CentOS Linux (***) 7 or 8 (Core) and press “e” for editing the selected item.

CentOS Linux 8 or 7 (Core)

It will allow you to edit the sysroot file for resetting the lost CentOS Linux password. Make sure you do all tasks correctly as you see on the screenshots.

2. Now, scroll down to the list until you see the line underlined below (ro). Just delete the selected yellow code and replaced with the next screenshot code.

Edit CentOS Linux Boot Loader File

3. Here you just need to do is change that “ro” to “rw” in order to start next into a bash shell. It should look like this “rw init=/sysroot/bin/sh“. See the screenshot as well.

Change the ro line to rw and add init=/sysroot/bin/sh

4. After changing the code, press “Ctrl+X” on your keyboard to start into single-user mode using the bash shell specified above. In this mode, you are able to change the CentOS root password.

Reset CentOS Root Password  – Technig

5. Finally, type “chroot /sysroot” command and press Enter. Next type “passwd root” to change the root password. Type the new password twice and press Enter.

On the final step, after creating the password, type the “touch /.autorelabel” command to update SELinux parameters. When done, exit and reboot the system. CentOS 8 root password default

That’s all you have to learn to reset CentOS 8.x root password default or change root password CentOS 8.x and 7 using the command line.

CentOS Remote DesktopCentOS TipsData Recovery ToolHow toPassword RecoveryReset Lost PasswordReset Password
Comments (0)
Add Comment