Booting into single user mode is the easiest way to gain access to a Red Hat Enterprise Linux/CentOS server.
-
You would now edit the main kernel options, adding either “single” or even just “1” at the end. Once you have completed that hit enter, the “b” for boot.
-
You are now in single user mode, and be auto logged in as root.
# setenforce 0
Now you should be allowed to change your root password.
Take look on the following pictures you will find that grub counting the time to boot the default operating system as mentioned in /etc/grub.conf.
That time press any key to interrupt, you will see the list of kernel that is installed on the machine. In my case there are three kernels.
- Updated centos kernel with xen.
- Default installed kernel with xen.
- Default installed kernel without xen.
Select the kernel in which you want to login by using arrow keys, once selected press ‘e’ to edit the kernel parameters. Once press you will find the screen like below.
Now you go to the third line, which starts with module /vmlinuz-2.6.xx.xxx.x.xen ro root=LABEL=/ rhgb quiet. Press again “e“ to edit.
At the end of the line insert word “single”. It will look like below.
If you see full line, it looks module /vmlinuz-2.6.xx.xxx.x.xen ro root=LABEL=/ rhgb quiet single
Once done press Enter, you will get the following screen with selection of third line. Press ‘b’ to boot the kernel with edited parameter.
Once booted it will go to hash prompt i.e. root prompt without asking password. See below.
That’s it.
Leave a comment