CentOS7 forget the root password approach

CentOS7 graphical pages and other machines

1, start the system, in GRUB2 boot page, click on the (E) key to enter edit the boot entry

 

 

2, to delete the beginning (linux16) (rhgb, quiet) this line of argument, (linuxefi), delete these two parameters can be displayed on the system information

3. Add the following parameters, at the end of the line

rd.break enforcing=0

4, using CTRL + x with the changed parameter guidance system

5, (/ sysroot /) at the filesystem is read-only, can not change the password, to re-mount the file system can be written

mount -o remount,rw /sysroot

6, after being overwritten file system, change the system's root

chroot /sysroot

7, enter the passwd command, follow the prompts to change the root password

8, update password, re-mark all files

touch /.autorelabel

9, remounted read-only system

mount -o remount,ro / 

10, wait a moment to exit.

 

Guess you like

Origin www.cnblogs.com/security-guard/p/12381739.html