PDA

View Full Version : awfull mistake: root account deleted



chillz
17th May 2005, 04:32 PM
I've deleted "root" account from kuser.

I can't login to system, I was trying to mount my partition from rescue disk and adduser root, but it gives me an error that root account already exists, but I can't login anyway...

How to possible fix the situation?

AndyGreen
17th May 2005, 04:36 PM
Rescue disk job... boot from your install CD1, and type

linux rescue

at the first prompt. It should end up having mounted your normal root filesystem at /mnt/sysimage.

vi /mnt/sysimage/etc/passwd

insert this at the start of that file:

root:x:0:0:root:/root:/bin/bash

save the file, and then

chroot /mnt/sysimage
passwd

and give your root password. Then finally

exit

should reboot you into a happier place.

--edit

Oops, didn't read your message properly until after I posted :-(

Just try with the chroot and passwd parts. You might even need

passwd -u root

chillz
17th May 2005, 05:01 PM
can I edit /etc/shadow manually to add "root" entry?

AndyGreen
17th May 2005, 05:07 PM
Yeah, I guess so. This is what a user I just added -- and then deleted, ye hackers -- with the password "password" looks like in /etc/shadow:

grumpy:$1$FUvzeRMP$LpC9IVPBns0DRB909gPd01:12920:0: 99999:7:::

chillz
17th May 2005, 05:37 PM
Huh, Thank You, Andy! I'm in ;)