Results 1 to 2 of 2

Thread: Forgot your root password?

  1. #1
    Senior Member
    Join Date
    Sep 2003

    Forgot your root password?

    Say you set up a box and installed your favorite linux distro on it. Say that you wanted to try a spiffy new password that you think you will remember forever. Say you don't see the box for a month and that password has slowly seeped out of your brain. What do you do?

    Step 1:
    Find you a bootable linux OS (knoppix comes to mind), burn it, and boot it.

    When you have finished booting, mount your local drive:

    mount /dev/hda1 /mnt/test/
    Step 3:
    Change the root filesystem to the local hard drive

    chroot /mnt/test /bin/bash
    Step 4:
    Change yourself a password

    Step 5:
    Shutdown the OS, remove the disk, and reboot.

    Welcome back to your system!
    You shall no longer take things at second or third hand,
    nor look through the eyes of the dead...You shall listen to all
    sides and filter them for your self.
    -Walt Whitman-

  2. #2
    Leftie Linux Lover the_JinX's Avatar
    Join Date
    Nov 2001
    Beverwijk Netherlands

    lilo root

    If you use lilo there's another way..
    This is a repost, the origional can be found here:

    You have found your old linux box..
    ah.. nostalgia
    you just can't remember that fucking root password..

    you could boot from a bootdisk and eddit the /etc/shadow but that's not the nicest way..

    on most computers you can give the kernel added options in the lilo bootscreen..

    you can use the init= option to set an aplication to be started after boot

    adding the line init=/bin/bash rw should boot the puter and drop you into a root console on the read-write (rw) mounted root filesystem..

    so remember, if your normal kernel boot image's name is linux and the passwd executable is located in /usr/bin then:

    linux init=/usr/bin/passwd rw

    allows you to reset your root password in the neatest way !!

    playing around with init might result in a Kernel Panic !
    but after a reboot the password should be changed..

    Now, what do we do about that..
    We don't want anyone that read this doing it on my box..

    You could swich to an alternative boot loader, but let's not do that just yet..

    open /etc/lilo.conf in your favorite editor.

    add these lines somewhere at the top (right after prompt would be appropriate),
    and ehm.. insert your own password there

    save and execute lilo
    lilo might warn you and well it's advice is quite clear.. Warning: /etc/lilo.conf should be readable only for root if using PASSWORD
    chmod 600 /etc/lilo.conf

    be sure to man lilo.conf and find out more about lilo
    ASCII stupid question, get a stupid ANSI.
    When in Russia, pet a PETSCII.

    Get your ass over to SLAYRadio the best station for C64 Remixes !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts