Reset Linux Password!!

15 October, 2006

If you have forgotten a user’s password under Linux and you have root access, you don’t usually need a rescue disk because you can reset the password with the root account. Even if you have forgotten the root password, most Linux distributions let you log in to single-user mode (add the single or init=1 argument to the kernel at the boot prompt) and change the password from the root account.

A paranoid system administrator might password-protect or disable single-user mode altogether in /etc/inittab, but you can still get to a root prompt to reset the password if you pass init=/bin/sh to the kernel when you boot. However, if the boot loader itself is password-protected and you forgot the password, you must have some sort of rescue disk to reset the password both in the boot loader and in the /etc/passwd file.

It is simple to reset a password in Linux, and to reset a password with Knoppix requires just one extra step. Boot the Knoppix CD and mount your Linux system with read/write permissions:

knoppix@ttyp0[knoppix]$ sudo mount -o rw /dev/hda1

 /mnt/hda1

Replace hda1 with your root partition. Now run passwd under chroot, so that the passwd command changes the root password for the mounted system, and not Knoppix:

knoppix@ttyp0[knoppix]$ sudo chroot /mnt/hda1 passwd

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

knoppix@ttyp0[knoppix]$

To change the password for a user instead or root, invoke the same command but add the name of the user to the end:

knoppix@ttyp0[knoppix]$ sudo chroot /mnt/hda1 passwd username

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

knoppix@ttyp0[knoppix]$

With the password set to a new value, reboot and get back into your system.

3 Responses to “Reset Linux Password!!”

  1. Ted Doyle said

    Ya, kalau Dimas udah gede sih, akan tahu papi juga nakal persis dimas pada waktu dia sendiri cenik!

  2. daniele said

    con linux può funzionare ophcrack?

  3. asif said

    hi,

    i want to reset my server password and the OS is SUSESuSE Linux 9.1 (i586) VERSION = 9.1

    i tried to pass init=/bin/sh to the kernel and boot the system but it stopped while initiallizing the hardware driver

    then i used ur 2nd method to boot the system with Knoppix(V5.1.1CD-2007-01-04-EN.iso) media after reaching to command prompt i give following commands

    knoppix@ttyp0[knoppix]$ sudo mount -o rw /dev/hda /mnt/hda
    it gives me error (mount: block device /dev/hda is write protected , mounting read-only)

    even does not allow me to use this command:
    sudo chroot /mnt/hda passwd

    Note:
    i used hda instead of hda1(as mentioned in ur example)because when system booting with knoppix media a saw the line **knoppix found at /dev/hda

    i would be gratful if someone help me out..

    thanks in advance

    asif

Leave a Reply