Recipe 13.11. Repairing a Lost Root Password

 < Day Day Up > 

13.11.1 Problem

Oops, you lost your root password.

13.11.2 Solution

No problem whatsoever. Fire up Knoppix and open a root shell. Mount the filesystem containing /etc/shadow, and make it writable (see Recipe Recipe 9.10). Open /etc/shadow in your favorite editor, and find root's entry:

root:$1$7nMNZYci$E.U6ftxnAZU0rk29qvYpk0:12460:0:99999:7:::

Delete the password hash, which is between the first set of colons:

root::12460:0:99999:7:::

Now when you start up the system and log in as root, you will not be asked for a password.

13.11.3 Discussion

Don't forget to set a new root password.

This is yet another demonstration that "anyone with physical access to the box owns it." See Chapter 12 for tips on securing the boot process.

13.11.4 See Also

  • shadow(5)

  • Recipes 12.14 (Recipe 12.14), 12.15 (Recipe 12.15), and 12.21 (Section 12.21) for how to set passwords on LILO and GRUB

     < Day Day Up > 


    Linux Cookbook
    Linux Cookbook
    ISBN: 0596006403
    EAN: 2147483647
    Year: 2004
    Pages: 434

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net