What is the difference between using 'init' and 'rd.break' for reseting the root password?
I think the best way is as is shown in Red Hat documentation.
This is your second method. For GRUB2/RHEL7 single/emergency mode should not work since it will use sulogin
to authenticate you before presenting the command prompt.
So lets mark off different methods.
For RHEL5, RHEL6, append
1
,s
orinit=/bin/bash
to kernel cmdlineFor RHEL7, RHEL8, CentOS7, CentOS8, append
rd.break
orinit=/bin/bash
to kernel cmdline
It appears that the second method is not available on RHEL5 and RHEL6. But for RHEL7 I will prefer the first because adding init=/bin/bash is a bit tricky when single mode is password protected and may be appending rd.break
is a way to standardize it.
The ‘rd’ part of ‘rd.break’ refers to ramdisk— the initial ramdisk (initrd) environment.
The second method (using rd.break) is preferable for RHEL7. Some systems (with a USB keyboard or a VM) don’t actually seem to set the password when you reboot. Possibly it’s only setting the password for /etc/shadow inside the ramdisk, and not the one you were expecting.
What that has to do with a USB keyboard I don’t know, but that’s what the knowledge base arrival says, and what my experience to date has been. I rather suspect this has more to do with whether your root filesystem is on LVM (hint: dracut)