Friday, March 13, 2015

How to go into Single User mode when Password is needed in RedHat

How to go into Single User mode when Password is requested in RedHat


Sometimes you don't have the password when P2V'ing or just lost password, and adding a "Single" at the end of the kernel line doesn't work, and it still gives you a screen like this:


If you press Control-D, then the system just continues boot.

This is how you get past it:


Single User Mode when asked for root password for maintenance


1. Go to the VM Console (or Physcal Server console)
2. Reboot your machine; press 'Esc' repeatedly until you get to the GRUB menu; you will get something like this:


3. Press Enter, and select the kernel line (#2) 


3. press 'e' to edit; Edit the line to get rid of quiet and splash; change 'ro' to 'rw'; and add 'init=/bin/bash'. The line should look something like this:

grub edit> kernel /vmlinuz-2.6.32-220.el6.x86_64 root=/dev/mapper/vg_root-lv_root rw init=/bin/bash



Then press "Enter" and then "B" (to boot)  then it will give you a root prompt:


And that's it.  Of course you could also boot from a ISO file or a DVD, then mount the filesystem and change the password or whatever else you need to do, but this is quicker.

No comments:

Post a Comment