Indeed, the days have changed. The old school boys like me were happy with init.d and writing 1 in grub to boot into single user mode. RHEL7 demands something else these days. I am noting down such changes which I came across while working with RHEL7. If you are reading this I hope it will be of some use to you.
Forgot root password? Any other reason you need to go to single user mode? Here is how you do it.
- Reboot your RHEL7 machine
- Edit your grub config parameters by hitting the ‘e’ key
- Go to the kernel parameters lines and append “rd.break” at the end of line
- Hit CTRL-x to boot with these changes
- You are in single user mode with limited commands now.
- Run following commands to remount the /sysroot directory and then chroot to it
- mount –oremount,rw /sysroot
- chroot /sysroot
- You are all set, you can use passwd command now to change your password
- If selinux is enforcing you may need to run the following command to make sure your changes are saved.
- touch /.autolebel
- use CTRL-D to get back into your favorite runlevel