password

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 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

fourteen + five =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>