Booting straight up to GRUB is not the default boot method for RHEL/CentOS 7.Step by step process of resetting the root password in RHEL/CentOS 7 Installation.
Reset root password on RHEL/CentOS 6
Step1: Boot or Reboot your CentOS/RHEL Server
After the reboot, it will come up to a boot countdown like see below image. Here, you can press any key. Then it will go to GRUB menu.
Step2: GRUB Menu
In GRUB menu, select the appropriate kernel version and press the Key "e". Now you will get the options menu for the kernel version.
Step3: Change Kernel Boot Options
To enter into single user mode; Go to second last line (Starts with linux16 or linuxefi) using up and down arrow then modify the ro argument.
Modify it to “rw init=/sysroot/bin/sh”. Once done, press “Ctrl+x”
Now you should be in command line mode with root privileges (without entering password). Now you can start to troubleshoot your system or can do maintenance of your system.
Step4: Set Root Password
chroot to access your system.
#chroot /sysroot
Reset the root password
#passwd root
Update SELinux information
#touch /.autorelabel
Exit chroot
#exit
Step5: Reboot your server
Once you have completed this, reboot and you have a new root password for your CentOS/RHEL Installation.
#reboot (or) init 6
you can use rd.break instead of init=
ReplyDeleteThis way is also good and rd.break is also good thanks for such a nice explanation
ReplyDelete