CentOS7 single-user mode to change the password [Reserved]

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https: //blog.csdn.net/ywd1992/article/details/83538730

---------------------------------------------------------------------------------------------------------------------------------------------------


1, the system starts, and when the screen starts GRUB2 i.e., the display screen shown in FIG. Press "↑ ↓" key to stay in this interface, press the "e" key to enter the edit mode

 

2, to find the beginning of the period "linux16", add "init = / bin / sh" after "UTF-8", while the need to remove "rhgb" and "quiet" parameter

 

 3, press "Ctrl + X" to restart the system, without requiring a password to enter the system at this time, as FIG.

 

 4, in a way remount rw "/", otherwise no write permission

1 mount -o remount,rw /

5, "passwd" plus the username of the form to modify user password

1 passwd root

 

 6, run the command "touch / .autorelabel" the selinux take effect, or it may not start, then run "exec / sbin / init" reboot the system

1 touch /.autorelabel
2 exec /sbin/init

Guess you like

Origin www.cnblogs.com/ccti7/p/12059878.html