Linux之centos7重置root密码
1、重启系统到以下界面是按’e’(此是centos7的方法)
2、往下翻,找到linux16开始的行,在行尾输入rd.break,然后按’crtl+x’
3、进入到单用户模式
4、输入以下命令
switch_root:/# mount -o remount,rw /sysroot #本来只能读,以读写的方式重新挂载
switch_root:/# chroot /sysroot #切换根
sh-4.2# echo 'Centos' | passwd --stdin root #修改密码
sh-4.2# touch /.autorelabel #需要此文件系统才会识别到你改了密码
sh-4.2# exit
switch_root:/# reboot