LINUX忘记root密码怎么办_单用户模式下重置LINUX系统密码的方法

首先重启进入GRUB,编辑内核命令行:Ubuntu/Debian添加"rw init=/bin/bash",CentOS/RHEL添加"rd.break",启动后挂载文件系统为读写模式,执行passwd修改root密码,最后重启生效。

If you forget the Linux root password, reboot and enter GRUB. Edit the kernel line: for Ubuntu/Debian, add "rw init=/bin/bash"; for CentOS/RHEL, add "rd.break". Boot into single-user mode, mount the filesystem as read-write, use `passwd` to reset the root password, and reboot.