Ubuntu enters the single-user mode, modifies the sudoers permission, and modifies the root password. If the sudoers permission is 440, you can directly use sudosu-to enter root (this command does not need to enter the root password) and then modify the sudoers file. After modification, su becomes the original user. Q: What should I do if I forget my password when I have installed ubuntu on the Virtual Machine and set a user? Also, how do I obtain the root user? Ubunturoot Password
Ubuntu enters the single-user mode, modifies the sudoers permission, and modifies the root password.
If the sudoers permission is 440, you can directly use sudo su-to enter root (this command does not need to enter the root password) and then modify the sudoers file. After modification, su becomes the original user.
Problem:I installed ubuntu on the Virtual Machine and set the user, but now I forgot the password. What should I do? Also, how do I obtain the root user?
The ubuntu root password is not empty or can be set by yourself, but randomly generated by the system. You set the password for your own account during installation. First question:
In the above case, you can select the second repair item on the grub interface, but if there is no grub, refer:
1. Restart ubuntu and then press "shirft" to go To the grub menu;
2. Select recovery mode and press "e" to enter the editing page.
Non-recovery mode: 3. Replace ro single with rw single init =/bin/bash; (In the above interfaceChangeRw single init =/bin/bash) 4. Press ctrl + x to enter the single-user mode. The current user is the root user;
5. Modify the sudoers permission in the/etc directory: chmod 0440 sudoers. You can also add the root password at the same time, so it will not be so troublesome next time;
6. Press ctrl + alt + del to restart; In virtualbox, You need to click send in the Control ListCtrl + alt + del Option :
Second question:
1. Enter su root on the terminal and prompt you for the root password. Of course you do not have the password. In this case, do not forget the powerful features of sudo. Use the second method.
2. Enter sudo su root on the terminal, which means that the system will be notified with the temporary root permission to obtain the root permission. Of course, the system will not reject you. Enter your password.
3. There are actually simpler commands, but it doesn't mean anything. Enter su-I.