Ubuntu enters the single-user mode to modify the sudoers permission and root Password

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.