Unix-like system, the root password is very important, the loss of the root password, meaning that the system will face replacement.
In order to keep the system, summed up several ways to retrieve the root password, in case of emergency.
Method One: Single mode
After using single mode to login the system, use the passwd root command to modify the new root password.
Scope of application: As with some Linux distributions, such as Redhat, the single mode also requires root password validation for security reasons. So this is not a good way to do all the things.
Method Two: Lilo
During the Lilo boot process, you can notify the kernel to start the shell only, without password verification.
Lilo>linux Init=/bin/bash
This is after boot, the file system is read-only mount,
Mount-o REMOUNT,RW/
Re-mount the file system in read-write mode.
passwd Root
Use the passwd command to modify the root password, or modify the/etc/passwd file directly
Do not forget to change the file system to read-only mode, because this time is unable to safely shut down the file system, forced to shut down the system, it may cause damage to the system.
Mount-o Remount,ro/
Scope of use: a system that is suitable for using Lilo to start .... I studied for half a day grub and did not find the grub scheme. Please let me know if you have any friends.
Method Three: Linux boot CD
Previously, it has been expected to have a Linux boot CD, launched directly into the Linux system.
Some Linux distributions now offer bootable CDs, such as Ubuntu,gentoo.
OK, with this bootable CD, what else are you afraid of?
Boot into the system, this time is mounted on a virtual file system,
mount/dev/hdxx/mnt/x x needs to fill in the actual situation, for example, the previous system is mounted under/DEV/HDA1, MNT under a directory for D, you need to write
mount/dev/hda1/mnt/d
Enter/mnt/d/etc, modify passwd file and shadow file.
Do not forget, after the modification, save, and then uninstall the file system.
umount/mnt/d
Scope of application: This method is still very wide, as long as you use the boot CD to support the original system file system, can be mounted on it, you can modify the root password.
Oh, how, quickly make a disc like this, put into their own tool bag inside it.