There are two methods to break into Debian based Linux systems locally. you can use any method depending upon your convenience. Both works fine. Steps to reset the system’s password are fairly simple. These steps work for all the Debian based distros.
Conventionally Linux has 7 runlevels 0 to 6. runlevel defines the state of machine after the boot. These run levels are listed below.
0. Halt, Shutdown system.
1. Single user mode(Used for several administration tasks)
2. Multi user mode(Without networking)
3. Multi user mode with networking
4. Undefined(or user defined)
5.X11(Full multi user mode with graphical environment setup)
In order to reset the password we need access to the shell so we will boot into single user mode. For booting into single user mode turn on or reboot your machine and press e when the grub boot screen appears.
Now we need to modify some boot parameter to get your system into single user mode. Now go to kernel line which starts from “linux /boot/vmlinuz-…….".
Now go to end of the line and add the following code.
Now hit CTRL+X to boot.
You should now have access to shell. First thing we need now to remount the root filesystem in read and write mode so the changes we make stays as permanently. Execute the following command.
#mount -rw -o remount /
Now change the root password with following command
In order to change the any other user account password use following command
Type new password and hit enter. That’s it.
For using this method you would require a installation disk of other Linux distro. Boot your system from that live disk and mount the root partition of previously installed Debian Linux root partition on the hard disk. Now go to /etc directory and find and edit the shadow file with editor of your choice.
Find the line starting with root and remove everything between first and second colon (:). it should look like this.
Now save the file and reboot the system and remove the live installation media. You will now be able to login as a root user without password.