1. Restart the Ubuntu system. Press and hold the Esc key to view the boot options. 2. You can see the boot options in the list, there is such (recoverymode) in the end brackets, that is, the recovery mode. Select this option and press enter to continue. 3. Load the data for a while and go to the RecoveryMenu page, you can see the following options: resumecleandpkgfsckgrubnetrootrootxifx select root, that is, enter the trial root user.
1. Restart the Ubuntu system and press the Esc key to view the boot options;
2. You can see that there is a recovery mode in the brackets at the end of the boot Option List, that is, the recovery mode. Select this option and press enter to continue;
3. Load the data for a moment and go to the Recovery Menu page. The following options are displayed:
Resume
Clean
Dpkg
Fsck
Grub
Netroot
Root
Xifx
Select root, that is, enter the trial root user to recover the system. In this case, you can perform the superuser permission operation.
After you press enter, you can see the familiar
Root @ TUZKI :~ #
Command prompt.
4. Set or revoke the/etc/sudoers file permission
At this point, you can execute:
Chmod u-w/etc/sudoers
Revoke the w permission on the/etc/sudoers file. I directly added the root w permission and added the user shirdrn to the/etc/sudoers file.
Root ALL = (ALL) ALL
The following line is added under this line:
Shirdrn ALL = (ALL) ALL
This makes the user shirdrn a user in the sudo group and can execute super permissions.
Log out of recovery mode and restart the system. After entering, you can use the shirdrn user to create the/home/shirdrn directory:
Sudo mkdir/home/shirdrn
Because the shirdrn is already a user in the sudo group, run the cd ~ Run pwd to view the/home/shirdrn directory of the shirdrn user.