Recover root password - Fedora 8

InteractiveMind used Ask the Experts™
I've managed to change the root password. To what? I have no idea.

What I've tried so far, to recover it, is:

> Insert Fedora disc #1
> Select the Rescue Mode
> [After selecting <yes> a few times] get to a console

1)  (now try the solution suggested here: http:Q_22495405.html)

> Type:  passwd root

    But the output is:
    passwd: unknown uid 0

2)  (try the solution here:

That is:

> cd /etc
> vi passwd
> i
   (The only line that appears is:  root:0:0:root:/:/bin/bash)
> Esc + ZZ
> vi shadow
> i
   (This file is completely empty)

It would seem that I still have limited access, even when I boot to a console via the Installation disc.

Any suggestions?

Thanks very much

(P.S. I have about 4 hours of experience with Linux - so please be gentle)
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Judging from what the output was on attempt 1, I'd say that the root account may have been corrupted. Not sure how that happens but you can try doing this (not sure if it will work).

login into fedora as a normal user.
open a terminal
type: su
press enter when prompted for a password.

If you managed to log in as root, then the password was blank and from here you can type
and change the password accordingly.

If that didn't work then try this:

If all else fails....reformat

if the system does not respond to such tricks then you can try and do a reinstall of the OS with minimal selection

select the option NOT TO FORMAT THE PARTITIONS.  this is very important as formatting any partitions would be disastrous and leads to loss of stored data.  

when you do a minimal installation, it automatically sets the accounts straight without overwriting any of the data or config files
Kerem ERSOYPresident

There's something missing in the explanation above. To change the root password ou need first:
- Boot from the CD
- In the ":" prompt type "linux rescue" and hit enter.
- Once the reboot is complete you should have your system is mounted under /mnt/sysimage
- Make it your root using your system:
chroot /mnt/sysimage
- Only after thet you might be able to change your root password in your hard disk. another alternative is to edit your /etc/shadow and delete the password inside the file. The line should read something like that initially:

once youe done editing it should look like that:


Save & exit & reboot
now you should be able ro login using root
and without password. Just set a new password.

Ensure you’re charging the right price for your IT

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

Alternatively, just fire up the machine, then at the Grub bootloader screen, select the option to edit the boot line and put a 1 at the end of it. This will load the OS to run level 1 and drop you to a root shell without requesting any login credentials. At this point you can simply use passwd to change the root user's password.

> If all else fails....reformat

No no no no no. That's "the windows way", and it helps noone. Fix the problem and LEARN something, don't simply whitewash over it.
Kerem ERSOYPresident
> vi shadow
> i
   (This file is completely empty)

For you told so you might fill it this way:
Top Expert 2006


Problem solved.
Suffice to say: I'm a long-term Windows user. So a reinstall is what I went for.
Next time this [inevitably] happens, I will hopefully have the time to figure it out.

Thanks for all input.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial