Lost root password

Any way to recover a lost root password?  I am running RH 5.1.

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 up linux. At the lilo prompt type:

LILO: linux -S (or whatever your kernal image is called).

This will boot up into single user mode.

You can now edit the password file /etc/passwd manually. Look for the line that looks something like:


Delete all the alphanumeric garbage. (if you want to be sure it's the right field, count in the colon delimited fileds in other entrys. Quite a lot of users like daemons etc should have a '*' in this filed locking out the user.

Now reboot the machine and the root user will not have a password anymore.

Happy recovery (or hacking...)

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
use the rescue disk coming along with redhat
at the boot promtp type:

linux single

then mount your linux partition:

mount -t ext2 /dev/hda2  /

and finally run the command

passwd root

and change the root password

nhinmanAuthor Commented:
Serena77's comment gave me what I needed to change the root password.  Redhat 5.1 did not recognize the '-S' switch at the LILO: prompt.  It did recognize 'single' per Serena77's comment but I didn't need to use the rescue disk.  I also did not have to mount the linux partition.  It was done automatically.  

So all I had to do was enter 'linux single' at the LILO: prompt and enter 'passwd root' at the BASH# prompt.

Thanks Serena77!  ...and thanks Astroman for your good attempt.

I think Serena77 actually deserves the points.  How do I give them to her?

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Woops, you can't now, you gave them to me. I'm surprised the -S switch didn't work though. Maybe it should've been -s. It's definatly one or the other because I've done it before and it worked then!!

It never occoured to me to use the passswd command to update the root password - a bit dim really of me. Essentially, by editing the password file by hand thats what you would be doing.

I had to go through all this because after installing redhat 5, when it set my rootpasswordon install, I couldn't log in with it!


Zeldar: If you really want to give me some points you can post another question with the title 'points for serena77' or something ;)  Anyway the most important thing is that you solved the problem. Sometimes a simple reply  is a lot better than just points :)

nhinmanAuthor Commented:
Astroman:  Perhaps you could do what Serena77 is suggesting and split the points with her?  50/50 or whatever?
Thanks again, Zeldar
I can't, because expert points and spending points are 2 different things.

I have 5 spending points, and about 3000 expert points. The only thing I can think of is registering again as a second person and donating a load of points to serena77..

I wish I could spend expert points because I've got loads(well, a few), and bugger all spending points because I spent them all reading useless PAQ's.

Sorry about the whole thing, but at the end of the day, they are only abstract, and not anything real ;)

Sorry serena(77).
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.