Summary of solutions to common problems in linux (4) ubuntu resets the root password

method one:

If the user has sudo privileges, the following commands can be run directly:

#sudo su root
#passwd

#change password

Or run the sudo passwd root command directly to change the root password directly.

Differences about sudo su:

1. Common point: they all have the authority of root user;
2. Differences: su only obtains root authority, and the working environment remains unchanged, which is still the user's working environment before switching; sudo completely obtains root authority and root working environment.

Method Two:

If the user does not have the sudo authority, method 1 cannot be used, and you need to enter GRUB to modify the startup parameters of the kernel image. The ubuntu version used in this article is 11.04, and the specific process is as follows:

  1. Restart the computer and press the ESC key or F2 key to enter the GRUB boot mode as shown in the figure below, and select the recovery mode in the second line.
  2. An e enters the recovery mode, compiles the kernel and sets the startup parameters
  3. Add quiet splash rw init=/bin/bash after the linux /boot/vmlinuz... line. Then ctrl + x can run directly.
  4. After running, the system directly enters the root mode, and at this time, run the passwd command to change the password.

Guess you like

Origin blog.csdn.net/qq_40959462/article/details/126836637