Ticker

6/recent/ticker-posts

Header Ads Widget

Linux forgot password solution

Many friends often forget the root password of the Linux system. What should I do if the Linux system forgets the root password? Reinstall the system? Of course not! Enter single user mode and change the root password.
Proceed as follows:

Linux forgot password solution

Restart the linux system

 

Linux forgot password solution

Press Enter in 3 seconds, the following interface appears.
Then enter e

Linux forgot password solution

Enter single at the end of the second line, with a space. The specific method is to move to the second line by pressing the downward tip, press "e" to enter the editing mode.
Add single back to the back

Linux forgot password solution
Finally, press "b" to start, and then enter the single-user mode.
Linux forgot password solution

Now that you have entered single-user mode, you can change the root password. The password more command is passwd
Linux forgot password solution

Linux forgot password solution

[ Rescue mode using the system installation CD ]
The rescue mode is rescue, which is mainly used when the system cannot enter. For example, grub is corrupted or a configuration file modification error occurs. How to use rescue mode?
CD boot, press F5 to enter rescue mode
Enter linux rescue Enter
Choose a language, I suggest you choose English
 
Linux forgot password solution

Linux forgot password solution

Linux forgot password solution

Select us keyboard
Linux forgot password solution

Here you are asked if you want to start the network, sometimes it may be debugged online. We choose no
Tell us here that the system will be mounted in /mnt/sysimage.
There are three options:
  • Continue is to continue the next step after mounting. 
  • Read-Only is mounted as read-only, which is more secure. Sometimes the read-only mode prevents further damage to the file system when the file system is corrupted.
  • Skip is not mounted and enters a command window mode. 
Here we choose Continue.
Linux forgot password solution

At this point, the system has been mounted to /mnt/sysimage. Next press Enter and enter chroot /mnt/sysimage to enter the administrator environment.

Linux forgot password solution

Tip:  In fact, you can also change the root password in the rescue mode. This rescue mode is very similar to the windows PE system.
When chroot /mnt/sysimage/ is run, ls sees that the directory structure is the same as the directory structure in the original system.
That's right! The current environment is exactly the same as the original system environment. You can exit this environment by typing exit or pressing Ctrl + D. Then you ls look
This directory is actually the directory structure in the rescue mode, and our system files are all in the /mnt/sysimage directory.

Post a Comment

0 Comments