root user password reset – Redhat Enterprise Linux 7

Red hat Enterprise Linux 7 root user password reset process. We have to interrupt booting process of Linux machine then enter into the single user mode and reset forgot root user password. How to reset root user password in RHEL 7 / Centos 7 procedure explained step by step guide.

root user password reset – RHEL7

root user password reset in RHEL 7 / Centos 7

While Linux is booting when your machine is loading boot menu stop the booting process

edit kernel parameters

edit kernel parameters

press ‘e’ to edit the boot menu parameters

interrupt booting process RHEL 7

interrupt booting process RHEL 7

linux16 /vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root rhgb quiet init=/bin/bash LANG=en_us. UTF-8

we have to add init=/bin/bash after the rhgb quiet in kernel line linux16

bash-4.2# mount |grep root
/dev/mapper/rhel-root on / type xfs (ro,realtime,attr2,inode64,noquota)
check root mount point status

check root mount point status

/ mount point is in Read-only we have to make it to read-write so that we can change anything to do that remount the file system with read-write option

bash-4.2# mount -o remount,rw /
bash-4.2# mount |grep root
/dev/mapper/rhel-root on / type xfs (rw,realtime,attr2,inode64,noquota)
remount file system

remount file system

use passwd command to change current root user password (Set New one)

passwd command to change root password

passwd command to change root password

root user password has been resetted to new password, Here in RHEL 7 by default SELinux is in enforcing mode so that we have to relabel the SELinux context

To relabel the SELinux context just create an new file under / which will automatically reset required SELinux context to all the files

bash-4.2# touch /.autorelabel
bash-4.2# exec /sbin/init
SELinux relabling percentage

SELinux relabling percentage

Linux machine will be rebooted. while rebooting you observe that SELinux context applying status by looking yet above screenshot

That’t it about forgot root user password reset in RHEL 7

 

RHEL7 Second method Steps with screenshots

Related Posts

RHCSA and RHCE course content in detailed

Open LDAP Server installation and configuration Step by Step Guide

Please do write your comment about this post.

Thanks for your wonderful Support and Encouragement

blank

ARK

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

1 Response

  1. blank Prince says:

    /.autorelabel (not ./autorelabel)

Leave a Reply

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