Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Linux forgot the password workaround


May 22, 2021 Linux


Table of contents


Linux forgot the password workaround

Many friends often forget the root password of linux system, linux system forget root password how to do? R einstall the system? O f course not! G o into single-user mode and change the root password.

Here are the steps:

Restart the linux system

Linux forgot the password workaround

Within 3 seconds to press the return, the following interface appears

Linux forgot the password workaround

Then enter e

Linux forgot the password workaround

Enter single at the end of the second line, with a space. This is by pressing the tip down to move to the second line and pressing "e" to enter edit mode

Linux forgot the password workaround Add a style to the rear to return

Linux forgot the password workaround

Finally press "b" to start, after starting into single-user mode

Linux forgot the password workaround

Now that you're in single-user mode, you can change your root password. The more password command is passwd

Linux forgot the password workaround

Rescue mode for installing discs using the system

Rescue mode is reescue, which is mainly used in situations where the system cannot be accessed. F or example, grub corruption or a profile modification error. How do I use the reescue mode?

The disc starts and press F5 to enter reescue mode

Linux forgot the password workaround

Enter linux rescue carriage return

Linux forgot the password workaround

Choose a language, the author suggests you choose English

Linux forgot the password workaround

Select the us keyboard

Linux forgot the password workaround

Linux forgot the password workaround

Ask if you want to start the network here, and sometimes you may network debug. Let's choose no

Linux forgot the password workaround

Tell us here that the system will then be mounted in /mnt/sysimage.

There are three options:

  • Continue is the next step after mounting.
  • Read-Only is mounted as read-only, which is more secure, and sometimes when the file system is corrupted, read-only mode prevents the file system from getting closer to corruption.
  • Skip just doesn't mount and goes into command window mode.

Here we choose Continue.

Linux forgot the password workaround

At this point, the system is mounted to /mnt/sysimage. Next, enter chroot /mnt/sysimage into the administrator environment.

Linux forgot the password workaround

Tip: You can actually change root's password in rescue mode. This reescue mode is very similar to the windows PE system.

When chroot/mnt/sysimage/, Ls sees that the directory structure is the same as the directory structure in the original system.

That's right! T he current environment and the original system environment are exactly the same. Y ou can enter exit or exit the environment by pressing Ctrl plus D. And then you take a look

Linux forgot the password workaround

This directory is actually the directory structure in rescue mode, and all our system files are in the /mnt/sysimage directory.