So easy, can not be!
Principle:
by entering single-user mode (the single-user mode is only one user can access the state of the resource, and the single-user mode is the system in the most original state, most services are not yet open), you can modify the password
Steps:
1. Press and hold while booting Shift key Enter Grub Interface (Grub is a boot loader, similar to a PC BIOS)
2. use the keyboard up and down to move to the second row of recovery mode, Press E (note not enter)
3. move the cursor to the third line and replace "ro recovery nomodeset" with " RW Single Init=/bin/bash "
4. then press the Ctrl + x , which goes into single-user mode
5. Enter a command to change the password: passwd + username (user to modify)
GRUB Encryption:
· Description: to prevent others from changing the password by using the above method, grub can be encrypted and inaccessible if someone does not know the account and password that the grub encrypted.
Specific operation:
1. Make Secret password
Input command: GRUB-MKPASSWD-PBKDF2
Prompt to enter the password to encrypt, such as 123
Generate the password you want to encrypt, and copy it.
2, modify/etc/grub.d/00_header, append at the end:
Cat <<eof
set superusers= " test " // test is an encrypted account set for grub
PASSWORD_PBKDF2 Test grub.pbkdf2.xxxxxxxx/ /Back is the encryption password made above
Eof
3. Update Grub
Input command: UPDATE-GRUB2
4. The next time you enter grub, you will need to enter your grub account and password (e.g., account test, password 123) for modification.