Link to home
Start Free TrialLog in
Avatar of chonsp
chonsp

asked on

Forgotten root password

I can't seem to get my root password to work.  I've tried all combinations of upper and lower case and have to assume I've mistakenly recorded what it was.
I can get in as another user with basic privledges.
How can I reset the root password?
Avatar of mart010897
mart010897

It depends on what distribution you have, but what you want to do is boot from a floppy disk (Slackware you can use your boot disk; RedHat you can use a "rescue" disk) and get to a shell prompt.

Then mount your Linux's root filesystem somewhere like mount-- say your Linux root filesystem is on /dev/hda3, you would "mount -t ext2 /dev/hda3 /mnt".

Now you can edit the passwd file (vi /mnt/etc/passwd) on that filesystem.  Just remove the encrypted password from between the colons in the second field of root's line:

root:fjkhs897320:0:1:Super-User:/:/sbin/sh

becomes

root::0:1:Super-User:/:/sbin/sh

then remove the floppy and boot normally.  root's password will be null (you can just type root and get in).  Then change your passwd to something you'll remember!  :)

Good luck!

Mart

Avatar of chonsp

ASKER

Its Red Hat release 5.2.  Of course I have not gotten around to a rescue disk as of yet.
at LILO prompt: boot with single option

ASKER CERTIFIED SOLUTION
Avatar of rbr
rbr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Almost every linux distribution is able to create a boot disc from DOS/Windows with rawrite. Search your CD for bootfiles (bootdsk.144, ...) Also a short help file how to generate a bootdisc from DOS/Windows should be available on your CD.
Did you shadow your /etc/passwd file ? I assume that you have no other users that you can log in as to change the file ?

RedHat has a rescue disk available for download, I believe.  Remember, you don't need anything fancy, just a shell, an editor and the ability to mount a filesystem.  In fact, you can even use a set of Slackware boot and root floppies-- since you're not running the install program.

Good luck...

Mart

Hey, rbr, why did you post the same answer as me as an answer, not a comment?  That's a breach of etiquette as I understand it.  We're supposed to post as comments until the problem is solved, then whoever the user decides helped most posts the answer and gets the grade.  You posted my same answer after me.  If you get points for it, I won't like it.

Mart

Where are the instructions as to what is proper etiquitte?  My undestanding was that if a question hadn't been answered (with an "answer" response, not a "comment") it was open for anyone to answer.  If you were proposing an answer/solution, it should be submitted as an answer (locking it from other answers); if the answer wasn't "good enough", it would be rejected and the question opened up for answers again.

Why did you submit your original post as a comment, rather than as an answer?

The idea as I read it on the board before is that when you submit an answer, no matter how bad the answer is, it locks the question, and prevents a more qualified answer from being given, as the question will no longer show up in the "waiting for answer" list.

I posted as a comment, as I always do, to leave the question open in case someone with a better answer came along.  It should be up to the user to choose which answer suits him best.  

As you can see above, rbr's "answer" is much less descriptive than my comment, even though it describes the same procedure-- but my comment was posted first.  If my comment had solved the user's problem, I would have then posted it as an answer and allowed him to grade it.  

rbr's answer forces the user to reject the answer if any of the comments from other experts solved his problem.  It's also unfair to me because rbr can now get points for basically parroting my comment as an answer.
If the answer is "bad", it will be rejected and re-opened for answering.  You'll then have your chance to answer it and get your points.  In the meantime, you can still post your comments and help out.

The way I see it, if you think you have the answer or a solution, post as such.  Keeps the process simple.

Hmm.  Doesn't seem fair to me.  Seems to me an expert's goal should be to help the user, not to garner points by whatever means necessary.  The comment approach seems to me to encourage better answers, since the user can then simply pick the best one.

mart-
I asked customer service about whether to "answer" or to "comment"... see "https://www.experts-exchange.com/Q.10111433" for the response.
Thanks.

It's still not on, though.

If I were you, Consp, I would reject rbr's answer. That way, solve arguments easily.
Agreed.  rbr's answer is the same as mart's...

Oh wow, I didn't know about that auto-grading.  That's even worse.

Avatar of chonsp

ASKER

I think I'll let this go with a passing grade and let the net-iguitte lesson be learned.  Enough time spent on this.

Thanks a pantload, rbr.