1.启动Centos7系统,出现下面画面时按“e”键。

centos7_reset_root_password_01

2. 在下图位置添加“rw single init=/bin/bash”,然后安“Ctrl+X”引导系统。

centos7_reset_root_password_02

3. 挂载根分区

bash-4.2# mount -o remount, rw /

4. 键入“passwd”即可重置密码。

centos7_reset_root_password_05-1

5. 运行命令“exec /sbin/init”来正常启动系统,需要输入修改后的root密码

centos7_reset_root_password_04-1