linux root密码重置

1.开机进入linux内核

  按e,  进入编辑模式

2.找到内核版本号输入  

  rd.break  按ctrl+x,  进入switch_root

3.mout查看、重新挂载根分区

  mount - o remount,rw / sysroot

4.切换到sysroot

  chroot /sysroot

5.重置密码

  passwd root

6.重新生成relabel,selinux在重启后 更新label

  touch /.autorelabel

7. exit

8.reboot 重启

posted @ 2020-09-22 13:08  web男  阅读(206)  评论(0编辑  收藏  举报