centos8重置root密码

1.开启centos8,进入启动页面

2.按’e’进入编辑模式(edit select item)

 3.ro改为 rw init=/sysroot/bin/bash

 4.按Crtl+X启动

 5.运行命令: ‘chroot/sysroot/’ (用chroot 命令把根目录切换到我们原来的环境中,也可以理解为以 root 权限登录了原来的系统)
设置环境为英文环境: ‘LANG=en’;
修改密码:'passwd’

 6.使SELinux 生效:输入 touch /.autorelabel

 7.reboot(重启)

原文地址:https://www.cnblogs.com/jinjingBlog/p/13390206.html