We often encounter the forgotten root password situation, the following is the solution,
This method uses the vast majority of Linux distributions:
1. First Enter GRUB
2. At the entrance to edit, press E to add after quite
Init=/bin/bash, press Ctrl+x to start. Note: The quite here are generally
The most popular word on the web-the second line, which specifies kernel's
That line. In fact, on the present system, it may be a long time ago.
For example, on my Debian system, this is the line:
linux/boot/vmlinuz-3.14.18 root ... ro quiet
Therefore, we only need to add init=/bin/bash after the line quite
It's OK.
3. After booting, execute the following three commands:
# Mount-o REMOUNT,RW/
# mount-a
# passwd Root
If the system does not have the root password set, go directly to recovery mode
You can then execute the three commands mentioned above.
By the way, add the user to the sudo group by: usermod-g sudo username.
Linux forgot root password