RTFM for the series, following the instructions set out on the Italian official Debian documentation for the recovery of the root password. I do use and consumption of a very lazy person that I asked.
8.1.1 "I forgot the root password!" (1)
E 'can boot the system and access to the root, even if we do not know the password, you have access to the keyboard. (Given that there are no other requests from the BIOS password, or boot-loader type lilo that would prevent the system.)
This procedure does not require any boot disk and no change in BIOS. In this context, "Linux" is the label for booting the Linux kernel in the standard Debian install.
At the lilo boot screen, as soon as boot: (you must press a shift key to Prevent automatic booting) and if lilo uses the framebuffer you have to press TAB to see the options you type), date:
boot: Linux init=/bin/sh
The system starts the kernel and run / bin / sh instead of its standard init. Now you have gained root privileges and root shell. Since / is mounted read-only and many disk partitions have not been mounted yet, you must do the following to have a reasonably functioning system.
init-2.03# mount -n -o remount,rw /
init-2.03# mount -avt nonfs,noproc,nosmbfs
init-2.03# cd /etc
init-2.03# vi passwd
init-2.03# vi shadow
(If the second data field in / etc / passwd is "x" for every username, your system uses shadow passwords, and you must edit / etc / shadow.) To disable the root password, edit second field in the password file so that it is empty. Now you can reboot and log in as root without a password. When booting into runlevel 1, Debian (at least after Potato) requires a password, while some older distributions did not.
It 'good idea to have a minimal editor in / bin where / usr is not accessible (see Rescue editors, Section 11.2).
Also consider installing the sash. If the system becomes unbootable, execute:
boot: Linux init=/bin/sash
sash serves as an interactive substitute for sh even when / bin / sh is unusable. It has a link, and includes many basic utilities into it (type "help" to prompt for a reference list).
8.1.2 "I forgot the root password!" (2)
Boot from any disk set of emergency boot / root. If, for example, / dev/hda3 is the original root partition, the following will help open the files password easily as above.
# mkdir fixit
# mount /dev/hda3 fixit
# cd fixit/etc
# vi shadow
# vi passwd
The advantage of this approach over the previous method is that it does not need to know the lilo password (if any). But one must be able to set the BIOS, if it is not already, so the system to boot from floppy or CD.
Source: http://www.debian.org/doc/manuals/reference/ch-tips.it.html