After Ubuntu installation, the default root cannot log into the system, the password is randomly generated, other users use root privileges, you can use sudo, if the user in the/etc/sudoers configuration list.
But sometimes the user name from/etc/sudoers was accidentally deleted, sudo can not be used, Root does not know the root password (not changed or forgotten), if you want to modify the/etc/sudoers is not possible, entered a dead loop.
However, this can be solved as follows:
1. Restart press SHIFT key, enter Ubuntu Advanced mode, select a recovery mode to enter, there is a menu of 9 options, if it is installed language is Chinese may appear garbled, but does not affect the operation.
2. The menu is: Resume resume normal startup, clean clear disk free space, dpkg repair damage package, fsck disk repair, grub update boot program, network turn on the web, root into root shell.
Here first select Fsck Select the left button yes into read-write mode, and then return to select root to change the file, in the root of the shell can modify the root password, will need to add the user name sudo to the sudo group
$passwdsudo qingspace
In fact, open the/etc/sudoers file, you can also see the sudo user group allows sudo to take the right, the user into the sudo group can execute the sudo command, here need to be careful to modify the user group need to restart to take effect.
# User Privilege Specificationroot all =(All:all) all# members of the admin group may gain root privileges%admin all=sudo To execute any command%sudo all= (all:all) all
3. If the recovery mode in Chinese garbled, you can try to rename the files in the following directory, so that the interface back to English (Ubuntu16.10 test)
$CD /usr/share/locale-langpack/zh_cn/lc_messages/$sudomv Friendly-recovery.mo friendly-recovery.mo.bak$sudomv newt.mo Mvnewt.mo.bak
650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/8F/A5/wKiom1jnVRXA7hQgAAAkbJi_ 4sm669.png "width=" 629 "height=" 280 "/>
Ubuntu is unable to sudo the right to report that the current user is not in the Sudoers file error