Rooting the root

Ever had one of those times when you’ve fired up an old Linux box, gone to do something that needed root and forgotten your password? Yeah… Me neither. But! I’ve put together this little tutorial to help you reset the root password should you ever forget it.

You will need a live distribution for this (a live distro is a Linux distro that boots and runs off of a cd). I used Knoppix for this article but you can take a look at distro watch to see other Live distributions.

First of all, Insert your live distribution into the CD-Rom drive and reboot. Once the machine has restarted and you are sitting on the Live distributions desktop change the crappy wallpaper you can begin.

1. Open a new terminal session and mount our target drive (e.g. mount /dev/hda1)

2. Once the drive is mounted we want to chroot to it (e.g. chroot /mnt/hda1 ) - this will will virtually log you into the broken distribution as the root user (No password required).

3. Open /etc/passwd with a text editor and locate the line that begins with root:x:………. Once you have found this line delete the x as this is what tells the computer that this line is shadowed.

4. Open /etc/shadow and search for the entry for root. Delete all the values on this line so that it looks like root::::::::. Save the file and proceed.

5. Take out your live distribution cd, boot into Linux and login as a user other then root

6. Now you can use passwd root to set the new root password, for example:

# passwd root
Changing password for root
New password:
Verify password:

All done!

Digg This

15 Responses to “Rooting the root”

  1. komodo Says:

    Impressive Skelm!
    I dont use a Linux, but why not in the future? For today, I’m using the traditional old Windows XP SP2.
    Linux is for free and many computer come with them here, so not hard finding linux to use.

    Really intresting and nontheless usefull!

    Keep on writing Skelm :D

    ~komodo

  2. skelm Says:

    Komodo,

    and hey, if you ever get an old computer and you don’t know the root password at least you will be able to recover it :D

  3. rick` Says:

    that’s a neat trick :P

  4. toggles Says:

    Wow!

  5. nhjm449 Says:

    The process, simplified: (You don’t even need to download, burn, and wait for a fancy livecd to boot or edit any /etc files)

    1. Boot your distro’s installation CD and go to a console (probably Ctrl+Alt+F1 if it has some crappy graphical installer that doesn’t include this as an option)
    2. Login as root (password should be blank)
    3. # mkdir /mnt/drive
    4. # mount -t auto /dev/hda1 /mnt/drive (modify as needed)
    5. # chroot /mnt/drive
    6. # passwd (do what it says)
    7. Eject CD and reboot

  6. testing Says:

    Hello!Just a testing :)

  7. business opportunity center Says:

    Well, I hope you’ve found the direction for this..so far..so good…I finally got my site up and made my first profits…take a look..ok? CYA

  8. chinese erotic art Says:

    chinese erotic art…

    Reviews on chinese erotic art….

  9. ps3 mod chip Says:

    ps3 mod chip…

    ka-ka-sh-ka 2032298 Features of ps3 mod chip….

  10. restaurant chicago il Says:

    restaurant chicago il…

    ka-ka-sh-ka 2032298 Research about restaurant chicago il….

  11. collection lawyer new jersey Says:

    collection lawyer new jersey…

    collection lawyer new jersey foundation…

  12. box insider red Says:

    box insider red…

    Advantages of box insider red….

  13. game new yankee york Says:

    game new yankee york…

    game new yankee york intro article…

  14. old country roses Says:

    old country roses…

    Master information for old country roses….

  15. heavyweight dub champion Says:

    heavyweight dub champion…

    Eye of heavyweight dub champion…

Leave a Reply