How to reset root password in Linux

Introduction

If you forgot your root password, then it’s not a big deal. Below are the methods to reset root password in different linux distributions.

Step 1: Power on Redat/CentOS 7 Server

First power on your Redhat/CentOS 7 server. At the boot menu, select the Kernel you want to boot up and press e to edit the selected boot entry.

Password1

Find the line rhgb quiet :

password2

and replace it with init=/bin/bash

Password3

 

Then press CTRL+X to enter into single user mode.

Step 2: Mount / partition

# mount -o remount,rw /

Step 3: Change root password

# passwd root

Step 4: Create File

# touch /.autorelabel

Step 5: Execute Command

# exec /sbin/init
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments