How To Reset Root Password in CentOS 7/6

Steps to reset the password of your root user on CentOS.

This tutorial today will analyze in a simple way how to reset or modify the password of any CentOS 7 user, either the root user or any other active user of the system.

Reset Root User Password in CentOS 7

First, we will analyze how to reset the password of the root user in CentOS 7 which is the most recent version of CentOS.

Restart the operating system and access the options offered by the boot manager or GRUB and there we select the line of our operating system:

Once selected press the letter e to access the edition of the orders of that line.

Once there we will locate the line linux16 where we can see the word ro:

We modify this word ro by

rw init=/sysroot/bin/sh=/sysroot/bin/sh

We use the combination of keys Ctrl + X to apply the changes and boot the system.

There we will access the system using the following line:

chroot /sysroot/sysroot

then we reset the password of the root user by executing the following:

passwd root

Now we update the SELinux information by running the following command:

touch /.autorelabel/.autorelabel

We left the system using the exit command and reboot the system using reboot.

In this simple way, we have reset the root password in CentOS 7.

Reset Root user Password in CentOS 6

To reset the password of the root user in CentOS 6, it will be necessary to carry out the following process:

Restart the operating system and in the boot window press any key to access the CentOS 6 menu:

Next, we access the start menu of CentOS 6 where we will select the operating system and press the key a  to modify the kernel boot arguments of the system.

We have two options to access the simple boot mode using a number 1 or a letter (s):

Press Enter and on the command line displayed enter the command passwd and assign the new password for the root user.

Once finished we can restart the operating system and access with the new password to the system.

Similar Posts

Leave a Reply

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