The root of Ubuntu is forbidden by default, and the password of root is not required to be set during installation. To use it, just set the password for root, sudo passwd root. If you just forget the password of ordinary users, you can change it with root. If you forget the root password, enter single user mode
Enter single user mode:
1. When booting to grub loading, please wait…, press ESC to enter the Startup menu, select the recovery mode of the corresponding kernel version, and press e to enter the editing state
2. Move the cursor, change “recovery nomodeset” to “rwsingleinit =/bin/bash”, and then press Ctrl + x to enter single user mode
Then we can use the command passwd to change the password
See: root @ (none):/# enter “passwd” immediately
See: enternewunix password: enter “123” immediately
See: retypenewunix password: enter “123” immediately
The new password is 123
4. Enter “reboot” enter! Can also ctraltdel. In short, restart it
1. Start the system. During startup, press ESC or shift key repeatedly until the following interface appears:
Move up and down, select advanced options for Ubuntu (or some versions show advanced options for Ubuntu), and then press’ Enter ‘to enter the following interface
Select Ubuntu, with Linux 4.13.0-38-generic (recovery mode), as follows:
Press the ‘e’ key to enter the interface as follows
Move the cursor through the up and down left and right keys to find the line of Linux/boot /… Ro recovery nomodeset, as shown below
Change ro recovery nomodeset in the figure to quiet splash RW init =/bin/bash, and the result is as follows
Press’ Ctrl + x ‘for a few seconds to enter the interface as follows:
Enter the command passwd as follows
Press “enter”, the interface is as follows:
After entering the password once, press “enter” and press enter to enter the password again. The interface is as follows
After entering the password twice, press the “enter” key, and the interface is as follows:
The password is entered successfully
Restart the computer (if it is a virtual machine, restart the virtual machine), enter the terminal, enter the command Su – the interface is as follows
Enter the password you just set. The interface is as follows