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

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
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
1 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

How to fix “dial unix /var/run/docker.sock: connect: permission...

August 10, 2021

How to connect to your VirtualBox VM from...

August 8, 2021

How To Install Cloudflare Origin SSL Certificate with...

July 20, 2021

How to Stop all Docker Containers

June 8, 2021

Cloudflare Origin SSL vs. Let’s encrypt SSL

May 9, 2021

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

1 comment

How To Install Cloudflare Origin SSL Certificate with Nginx. | Geekdosage July 20, 2021 - 3:30 am

[…] How to change the forgotten root password in CentOS 8 […]

Reply

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 remove/delete user in Linux

  • How to Create a Private Docker Registry in Ubuntu 20.04

  • How to Install Docker on CentOS 7

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

  • How to fix “dial unix /var/run/docker.sock: connect: permission denied” error

    August 10, 2021
  • How to connect to your VirtualBox VM from your Host OS using SSH

    August 8, 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