RHEL 5 Lost root password

I have a VM machine built with number of 3rd party applications.
The guy who built it has left no passwords & now out of touch.
I need a root password reset. How can I do it?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

boot into single usermode (maintenance) - when grub comes hit e to edit and put a 1 @ the end of the line. press enter b and enter again.

Your will now have your System booted as a single user and you will have no need to enter a password.

Now you can change the password like this



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
crazywolf2010Author Commented:
Thanks. How do you get to maintenance mode? All I can see is a startup menu.
@ the red screen hit e to edit and @ the end of the first line hit space and then put a 1  hit enter b enter
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

crazywolf2010Author Commented:
No luck. I tried this well. Please see attached image.
I'm sorry when you press e the first time you should be able to pick which kernel you can boot into, pick the default one then hit e again. you want to modify that line. not going into the actual grub cli.
Something like this the letter commands are at the bottom
Something like this the letter commands are at the bottom
madunix IT Specialist Commented:
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.
-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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.