Forgot the password for Ubuntu and the root password? Although it is a small probability event, some people have encountered it. What should we do? Oh, don't worry. Thanks to the headmaster for his methods. I would like to give it a thumbs up! Ubuntu root is disabled by default. During installation, you are not required to set the root password, which is different from the Red Hat system series. To use root in Ubuntu, we can use the terminal to set the password sudopasswdroot for the root user,
Forgot the password for Ubuntu and the root password? Although it is a small probability event, some people have encountered it. What should we do? Oh, don't worry. Thanks to the headmaster for his methods. I would like to give it a thumbs up!
Ubuntu root is disabled by default. During installation, you are not required to set the root password, which is different from the Red Hat system series. To use root in Ubuntu, we can use a terminal to set a password for root.
sudo passwd root
If the password of a common user is forgotten, use root to modify the password. If the root user forgets it, it enters the single-user mode, which is different from the Red Hat system series.
The specific method is as follows:
Enter single user mode:
#1. When the machine is started into grub, use the up/down key to move to the recovery mode of the second line, and press e (note that it is not the carriage return)
#2,
SetRo singleChangeRw single init =/bin/bashAnd press ctrl + x to enterSingle User ModeYou can do whatever you want. (It's a command line, so you have to understand how to use it !) You can change the password of a common user or the root user. Prompt: Press ctrl + alt + delete to restart the system. (I tried to shut down the system by using the command. I can only use this command to restart the system ).
I have tried these things and they are also successful. Please try them! I have read some methods on the Internet and tried some of them! Some methods use the Red Hat system series, and some are incorrect!
To change the password of a common user, run the following command:
PasswdUser Name