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、開機

3、開機, 按下e進入內核編輯頁面

4、在此處增加rd.break

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

6、執行 chroot /sysroot

7、執行passwd,並輸入新密碼(輸入兩次)

8、執行touch /.autorelabel

9、執行exit

10、執行reboot
11、輸入剛才設置的密碼登錄即可

