Forgot the root password? This is how to fix it.

I forgot my root password, how can I get into my system?

•I forgot root password and couldn’t get into my system.
•How to get into system?

•Red Hat Enterprise Linux

You can change your root password from single user mode or rescue mode. Getting into single use mode depends on your bootloader:


1. None grub password protection
Booting into single user mode using GRUB is accomplished by editing the kernel line of the boot configuration. This assumes that either the GRUB boot menu is not password protected or that you have access to the password if it is.

When the system boots up, you will see the Grub countdown, which is set to 5 seconds by default . Press “Esc” to intercept this countdown and go enter a Grub menu. Then
• Press ‘e’ to start editing.
• Scroll down to the “kernel…” line. This line tells Grub which kernel to boot.
• Press ‘e’ again to edit this line.
• Move to the end of the line. You can add number “1” to the end.
• Once you have finished the change, press Enter to accept the editing.
• Then press ‘b’ to boot using that kernel and boot into runlevel 1(single user mode).

You can change the root password using the passwd command.


Remember, this change is not permanent. At next boot, it will be start in to default mode or modify the /etc/inittab file.

2. Grub password protection

If the GRUB boot menu is password protected and you do not have access to the password, then you will need to use a rescue disk to boot the system.

Follow the instructions given by the rescue disk boot process:
•Boot the system from boot disc1, once the system has successfully booted from the ISO image and Red Hat Enterprise Linux boot screen will appear. Type: linux rescue without the quotes, and hit enter at the prompt.

[F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue]

boot: linux rescue

•When prompted for language, and keyboard, provide the pertinent information for the system. When prompted to enable the network devices on the system, select: No
• Select: Continue when prompted to allow the rescue environment to mount Red Hat Enterprise Linux installation under /mnt/sysimage directory.
• Run the command chroot /mnt/sysimage and then chroot to your system image.
• Use the command passwd to change the root password of the system.


When the system comes to the LILO prompt, type linux single . When you get the # prompt you will need to type passwd root. This will update the password to a newer one. At this point you can type exit and your system should return to the boot sequence. Alternatively, you can reboot your system with the shutdown -r now or reboot commands. The system should boot up normally. You can now use your new root password to gain root access.

If LILO is configured to not wait at the boot menu (timeout value in /etc/lilo.conf set to 0) you can still halt the boot process by pressing any key in the split second before LILO boots the kernel.