The error "username is not in the sudoers file. This incident will be reported" appears in Ubuntu. Please tusudoers
Reference Web site http://www.maketecheasier.com/fixing-sudo-error-in-ubuntu/
In Ubuntu Linux:
When learning laruence's private dish, I used the following command:
<span style="font-size:18px;">usermod -G users username</span>
Username is your username.
Because the-a parameter is not used, my user is divided into the users user group, and the original user group is reset, only the users user group is left.
The sudo command cannot be used because there is no sudo user group.
Solution: reboot system on the x-windows GUI
Go to the grub page and select the selected items.
Select fsck and wait about 30 seconds.
Click "root" to enter the command line under "root ".
Enter
<span style="font-size:18px;">usermod -a -G sudo usernameusermod -a -G adm username</span>
Some systems are admin, but my system is adm. However, I have read that admin is used in the sudoers file,
Admin is not included in my/etc/group, so I cannot allow my users to use sudo when I add adm. Therefore, I still need to join the sudo user group.
<span style="font-size:18px;">## This file MUST be edited with the 'visudo' command as root.## Please consider adding local content in /etc/sudoers.d/ instead of# directly modifying this file.## See the man page for details on how to write a sudoers file.#Defaults env_reset # Host alias specification # User alias specification # Cmnd alias specification # User privilege specificationroot ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges%admin ALL=(ALL) ALL # Allow members of group sudo to execute any command%sudo ALL=(ALL:ALL) ALL #includedir /etc/sudoers.d</span>
Click resume to restart the system.
After restarting, you can enter root.
If you can directly use the su-command to directly access the super root user, you can directly modify the/etc/sudoers file.
Modify the user group to which the username user belongs.