centos7忘记root密码解决办法
服务器教程 2023-05-08 14:54 676

CentOS 7忘记root密码

1 - 重启系统 进入此界面后,按e进入配置界面

image.png

2 - 按键盘e键,来进入编辑界面

image.png

3 - 找到Linux 16的那一行,将ro改为rw init=/sysroot/bin/

image.png

4 - 现在按下 Control+x (Ctrl+x),使用单用户模式启动

image.png

5 - 现在,可以使用下面的命令访问系统

chroot /sysroot

image.png

6 - 重置密码

passwd root

image.png

注:此处输入新密码不会显示

7 - 更新系统信息

touch /.autorelabel

image.png

8 - 退出chroot

exit

9 - 重启你的系统

reboot

重启成功后就可以用刚刚修改的新密码登录服务器了。

Label:

  • centos7忘记root密码解决办法
Powered by ©IDCSMART