redhat8重置root密码

redhat8重置root密码

1、查看系统

[root@rhel8pc1 test]# hostnamectl
   Static hostname: rhel8pc1
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 73f2da100acd48f8891e11d2a3d353ab
           Boot ID: 4951cc8ed88245478d3a317ef2c32257
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux 8.0 (Ootpa)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:8.0:GA
            Kernel: Linux 4.18.0-80.el8.x86_64
      Architecture: x86-64

2、开机

redhat8重置root密码

3、开机, 按下e进入内核编辑页面

redhat8重置root密码

4、在此处增加rd.break

redhat8重置root密码

5、执行ctrl + x 进入救援模式, 然后执行:mount -o remount,rw /sysroot

redhat8重置root密码

6、执行 chroot /sysroot

redhat8重置root密码

7、执行passwd,并输入新密码(输入两次)

 redhat8重置root密码

8、执行touch /.autorelabel

redhat8重置root密码

9、执行exit

redhat8重置root密码

10、执行reboot

11、输入刚才设置的密码登录即可

redhat8重置root密码