Reset forgotten root password in Redhat 7

Red Hat Enterprise Linux 7: Recover forgotten root password.

This video tutorial is part of RHCSA Fast Track course.

Please use below cookbook to reset forgotten or unknown password in Red Hat Enterprise Linux, CentOS Linux, Scientific Linux, Oracle Linux and Fedora.

1) Reset Linux server if it is running.

2) Press “e” to edit default entry on grub bootloader menu.

3) Replace keyword “rhgb quiet” with init=/bin/bash

4) Press “CTRL + x” to boot into root shell.

5) Remount / (root) filesystem with read write options.

5.1) / (root) filesystem is mounted with ro (read-only options).
mount | grep -w "/"

5.2) Remount / (root) filesystem with rw (read write) options.
mount -o remount,rw /

5.3) Doublecheck if / root filesystem has been remouted with rw (read-write) options.
mount | grep -w "/"

6) Change root password.
passwd

7) Relabel SELinux context for entire root filesystem.
Below command will ensure that the SELinux context for entire filesystem will be relabeled after reboot:
touch /.autorelabel

8) Continue boot process – run exec /sbin/init command.
exec /sbin/init

Related Video Tutorials:

RHCSA (EX200) Fast Track