在RHEL7下重置密码
第一种方式:光驱进入急救模式
//做之前最好
selinux=disabled Conntinue
然后chroot /mnt/sysimag 然后编辑/etc/shadow文件
第二种方式:
1:编辑启动菜单按e,找到linux16行,在行尾加入 init=/bin/sh,同时在该行将rhgb quiet去掉(没去掉的话,屏幕无回显)
2:CTRL+X
3:mount -o remount,rw /
4:vim /etc/shadow
5:如果selinux处于开启状态 touch /.autorelabel
6:重启
第三种方式
系统选项界面按e
rd.break方法: 在最后加入rd.break (Linux16) rd.break的作用在于:从initramfs向实际系统移交控制权前,该操作会中断
进入交换模式以后输入下列指令: mount -o remount,rw /
sysroot chroot /sysroot passwd 回车 密码 touch /.autorelabel (确保所有未标记的文件(包括此时的/etc/shadow))在启动过程都会重新获得标记。
exit (退出)
reboot (重启)
备注:在7下面用之前6的单用户模式的话,是无法进行密码修改的!