The solution to the forgotten password under the Ubuntu virtual machine

      Because I haven't used the ubuntu system in the virtual machine for a long time, I forgot the password. I tried many times, the passwords are all wrong, and I feel broken inside. There are only two options: one is to reinstall the system, and the other is to retrieve the password. I don’t want to reinstall the system and can only retrieve the password. I have searched a lot on the Internet and found that the effect is not very good, and there will be some small mistakes. Through constant testing, it finally succeeded, and the following is the process, hoping to reduce the pain of making the same mistakes later.

    

       The system version numbers are as follows:

                                           

                                                        System environment diagram

  1. Restart the Ubuntu system, press and hold shift (here, note that the mouse button must be in the virtual machine, not in the windows) button to enter the Ubuntu GRUB menu, select the Advance Options for ubuntu option, as shown below:                                                                                                                                                                                                                                                                                                                                                                                                                                          GRUB menu options diagram
  2. Select Recovery mode in advanced mode, press the 'E' key on the keyboard to enter the editing mode (you must press the E key first, not the Enter key), as shown in the following figure:                                                                                                                                                                                                                                                                                    Mode selection
  3. In the editing mode, use the up and down keys to find RO, and change it to RW mode, as shown in the figure below, and finally press ctrl+ X to enter the system                                                                                                                                                                                                                                                                                                                                        ro becomes rw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  is entering the system part of the screenshot
  4. Enter the BIOS interface, select root and confirm, as shown in the following figure:                                                                                                                                                                                                                                                                                                                                                                                                                Select ROOT option                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  5. Use the command passwd to modify the password, format: passwd username (your own login username), and then enter the new password, as shown below:                                                                                                                                                                                                                                                                                                                                     Enter new password                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  6. After the modification is complete, directly use the reboot command to restart the system, and use the modified password on the login interface.                      

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325725765&siteId=291194637