前提条件:
# vim /etc/selinux/config
SELINUX=disabled
第一种
grub界面--> e --> vmlinuz那行最后添加 \init=/bin/sh --> ctrl+x --> # mount -o remount,rw /
# vim /etc/selinux/config
SELINUX=disabled
第二种
右键 --> 电源 --> 打开电源时进入固件
Boot --> CD-ROM Drive shift+移到最上面 --> exit --> exit saving changes --> yes
Troubleshooting --> Rescue a CentOS system
1
sh-4.2 # chroot /mnt/sysimage
bash-4.2 # //进入管理员模式
passwd //重新设置密码
打开电源时进入固件 --> Boot --> Hard Drive 修改启动状态 --> exit