RHEL 7 / CentOS 7 : Single User Mode / Recovering / Reset Root Password
Setting up the
rootpassword is a mandatory part of the Red Hat Enterprise Linux 7 / CentOS 7installation.
If you forget or lose your password, it is possible to reset it. Now it is known as Rescue Mode / Emergency mode in CentOS / RHEL 7, Previously in RHEL / CentOS 5/6 It was “Single User Mode”.
Note: In GRUB 2, resetting the password is no longer performed in single-user mode as it was in GRUB included in Red Hat Enterprise Linux 6. The
rootpassword is now required to operate in
single-usermode as well as in
Process: Resetting the Root Password
- Please follow this procedure carefully, any mistake can make your system / Linux unstable, Perform this own your on risk.
Start the system and, on the GRUB 2 boot screen, press the e key for edit.
Add the following parameter at the end of the
linuxefion UEFI systems (In case of VMWare like KVM or VirtualBox use rb.break instead of init=/bin/sh):
init=/bin/shThe Linux kernel will run the /bin/sh shell rather than the system
initdaemon. Therefore, some functions may be limited or missing.
quietparameters must be disables in order to enable system messages.
Press Ctrl+x to boot the system with the parameter.The shell prompt appears.
The file system is mounted read-only. You will not be allowed to change the password if the file system is not writable.To remount the file system as writable, run the
mount -o remount, rw /command.
passwdcommand and follow the instructions displayed on the command line to change the
rootpassword.Note that if the system is not writable, the passwd tool fails with the following error:
Authentication token manipulation error
To make sure that SELinux context of the files that were modified is restored properly after boot, run
exec /sbin/initcommand to resume the initialization and finish the system boot.Running the
execcommand with another command specified replaces the shell and creates a new process;
initin this case.Alternatively, if you wish to reboot the system, run the
exec /sbin/rebootcommand instead.
Enjoy RHEL 7 🙂 Enjoy CentOS 7 🙂 Enjoy Linux 🙂 Enjoy Open Source 🙂
Please Keep in Touch with Social Networking :-
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog