The simplest way is to boot from a USB flash drive (any system will do, as long as you have a text editor and supports Linux file system), select a random user in the /etc/shadow file, and change the HASH value of the password field. For $siicWeap hld1d7glzP9NCJRxvFDtl5gubgaRM3oWfFfNdDX3mxX1tkhWEUN0UbVYnNziwvkQuB43iDizJ.g9XyKq3wyl0game, the result is that the password under this username will become
It is recommended to modify the user who has forgotten the password or ROOT, because other users may be system users and cannot log in (knowing the password is useless)
1. Use the reboot command to restart; 2. Restart and then enter the interface to select the Linux system disk and click space to interrupt the startup; 3. Press E on the keyboard to enter the edit mode. If you want to scroll down the page, find For the kernel line (usually the second to last line), add rd.break at the end, and then press ctrl+x; the system will start again; 4. After starting, execute: mount -a remount on the command line interface, After rw /sysroot is executed, execute chroot /sysroot 5.passwd root. This step changes the root password; 6. touch /.autorelabel, enter exit twice and wait for the machine to start.
Although this method is troublesome, it is safer to use.
If it is a Linux operating system, it is actually very simple - single user login. The following uses Ubuntu14.04 to briefly demonstrate the specific operation process.
Turn on the computer, as shown in the picture below (no virtual machine is installed, the picture taken by the mobile phone is just right):
There will be an option at this time: Advanced Options for Ubuntu, select and press Enter directly,
Seeing that there are many options inside, select the option with recovery mode (don’t press Enter!), press the letter e,
4. The critical moment has arrived. On the fourth line from the bottom, you will see a line of linux /boot/ vm....ro recovery nomodeset, step 1: Delete recovery nomodeset step 2: Add quiet splash rw init=/bin/bash
at the end of this line
Press F10 to start.
If nothing unexpected happens, you will enter the system. Enter: passwd. The system will prompt you to enter a new password and end.
Single-user mode is too troublesome.
The simplest way is to boot from a USB flash drive (any system will do, as long as you have a text editor and supports Linux file system), select a random user in the
/etc/shadow
file, and change the HASH value of the password field. For$siicWeap
hld1d7glzP9NCJRxvFDtl5gubgaRM3oWfFfNdDX3mxX1tkhWEUN0UbVYnNziwvkQuB43iDizJ.g9XyKq3wyl0
game
, the result is that the password under this username will become1. Use the reboot command to restart;
2. Restart and then enter the interface to select the Linux system disk and click space to interrupt the startup;
3. Press E on the keyboard to enter the edit mode. If you want to scroll down the page, find For the kernel line (usually the second to last line), add rd.break at the end, and then press ctrl+x; the system will start again;
4. After starting, execute: mount -a remount on the command line interface, After rw /sysroot is executed, execute chroot /sysroot
5.passwd root. This step changes the root password; 6. touch /.autorelabel, enter exit twice and wait for the machine to start.
Although this method is troublesome, it is safer to use.
Add a relatively troublesome method that I have used
Use live usb to start the machine, then mount the file system, then
chroot
;You have already entered the system on the machine as
root
, and then you canpasswd you_user_name
set a password;Single user mode!
single mode
passwd root
Do you know the root password?
If it is a Linux operating system, it is actually very simple - single user login. The following uses Ubuntu14.04 to briefly demonstrate the specific operation process.
Turn on the computer, as shown in the picture below (no virtual machine is installed, the picture taken by the mobile phone is just right):
There will be an option at this time: Advanced Options for Ubuntu, select and press Enter directly,
Seeing that there are many options inside, select the option with recovery mode (don’t press Enter!), press the letter e,
4. The critical moment has arrived. On the fourth line from the bottom, you will see a line of linux /boot/
at the end of this linevm....ro recovery nomodeset,
step 1: Delete recovery nomodeset
step 2: Add quiet splash rw init=/bin/bash
Press F10 to start.
If nothing unexpected happens, you will enter the system. Enter: passwd. The system will prompt you to enter a new password and end.