Friday, August 8, 2014

Get into Single User mode in RHEL/CentOS 7 : Retrieve Root Password in RHEL/CentOS 7

The Redhat recommended way of doing this changed in Redhat 7. I discovered this while reading a forum in Linkdin. It's on pp 406-407 of the new System Admin guide on the Redhat site. It's basically the same, but some things have been added:

- Interrupt the boot and edit with 'e'.
- Add init=/bin/sh to the end of the 'linux' line. Additionally, REMOVE the 'rhgb' and 'quiet' parameters from the 'linux' line. If you don't you probably won't be able to type on the console. That's what happened to me the first time.
- Ctrl+X to boot.
- / is read-only so remount the root filesystem: mount -o remount,rw /. If you don't do that you will get token manipulation errors.
- Use the passwd command to change the password.
- touch /.autorelable to take care of selinux. I've skipped this step before and was then unable to boot.
- run the following: "exec /sbin/init 5" and bring the system up. I don't know why you need the 'exec' command, but you do. Do not try to reboot it until it comes up the first time. It will hang and your changes may not be synced. I guess you could go to run level 3 as well.

Thanks Jim Caron for helping out Fourm.

About Me

My photo
Greetings Friend! I am Linux scholar, trying to learn as much I can and share it with you. I am in mid of my Professional Career. Doing Good. :)