Geekdosage
  • Home
  • Computer hardware
    • GPU
      • AMD
      • Nvidia
    • Processor
  • Linux
    • CentOS
    • Ubuntu
  • Docker
  • Computer Software
    • Operating System
      • Windows
      • MacOS
      • Android
  • Gaming
  • Computer Science
    • Network Engineering
    • Comparisons
  • About Us

Geekdosage

  • Home
  • Computer hardware
    • GPU
      • AMD
      • Nvidia
    • Processor
  • Linux
    • CentOS
    • Ubuntu
  • Docker
  • Computer Software
    • Operating System
      • Windows
      • MacOS
      • Android
  • Gaming
  • Computer Science
    • Network Engineering
    • Comparisons
  • About Us
CentOSLinux

How to change the forgotten root password in CentOS 8

by GeekDosage November 25, 2020
written by GeekDosage November 25, 2020
Reset root password | CentOS

Introduction

What can you do when you have forgotten the root password of a CentOS 8 computer? In this tutorial, you are going to learn how to reset the root password. There are several methods to do this task. Here we will explain the easiest way.

First of all, reboot your computer and press the ESC key to interrupt the normal boot. You will see the list of available kernel versions on your computer. The latest kernel version is at the top of the list. [Figure 1.0]

kernal details window

Select the kernel version and press the ‘e’ key to edit the chosen entry. Use up, down arrow keys to select the line started with Linux word. [Figure 2.0]

Edit that line and replace the ro (read-only ) with “rd.break” string as below. [Figure 3.0]
It will break the boot process before the control handed from the initramfs to the actual file system.

Change the configuration carefully and then press ctrl + x to start the boot with changes. 

You will be directed to the root shell with the root file system for the actual system mounted as read-only on /sysroot. 

Mount the /sysroot as read-write. Use the following command for the remount.

mount -o remount,rw /sysroot

Then execute the following command.

chroot /sysroot

Now you can change the root password. 

passwd root

Now execute the following command to relabel all the unlabeled files with SELinux security contexts.

touch /.autorelabel

You can see the relabeling process going on.

Now you have completed all the required steps to change the root password. Type exit two times or just press Ctrl + d keys twice to reboot.

It will take a few minutes to finish relabeling the files.

After reboot, you can use the new root password to log into the file system.

Conclusion


In this tutorial, you learn how to change a root password from the single-user mode in CentOS 8.

Please comments on any doubts or suggestions.

GeekDosage
centoschange forgotten root password in centosLinuxpassword resetreset root password in centosreset root password in Linux
0 comment
1
FacebookTwitterPinterest
previous post
What is a Linux OS? Why Linux is so popular?
next post
How to Install Docker on CentOS 7

Related Posts

Best 10 Docker Hosting Services

April 7, 2021

How to Exit Vim

March 11, 2021

SCP Linux – Securely Copy Files in Linux...

February 22, 2021

How to Copy, Paste and Delete in Vim...

February 7, 2021

How to Copy Files Between Linux Servers Using...

February 4, 2021

passwd: Module is unknown issue in Ubuntu

January 26, 2021

How to Kill A Process In Linux? Simple...

January 24, 2021

2 Simplest Methods to Take/Capture Desktop Screenshot in...

January 17, 2021

How to remove/delete user in Linux

January 11, 2021

How to rename a Directory in Linux?

January 5, 2021

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

Keep in touch

Facebook Twitter Google + Instagram Pinterest Email

Popular Posts

  • How to change the forgotten root password in CentOS 8

  • How to Install Docker on CentOS 7

  • How to Build a Docker Image from Dockerfile

  • Best GPU stress test software to test your GPU

About Geekdosage

Geekdosage is a technology based website which mainly focuses on network engineering, computer science, automation, computer hardware and software and internet technologies. Our purpose is to create a platform where anyone can access the subject areas without barriers.

Recent Posts

  • Best 10 Docker Hosting Services

    April 7, 2021
  • How to Exit Vim

    March 11, 2021

Find us

Facebook Twitter Instagram Pinterest Email
  • About Us
  • Contact Us
  • Disclaimer
  • Terms and Conditions
  • Cookie Privacy policy
  • Privacy Policy
  • DCMA

@2021 - All Right Reserved | Designed and Developed by GeekDosage