This article explains how to "fix" sudo not working on Linux, resulting in this message when trying to use it: "your-username is not in the sudoers file. This incident will be reported." on Debian (and Debian-based Linux distributions like Ubuntu).
The solution 1 here is:
su -
usermod -aG sudo YOUR_USERNAME
exit
- First, switch user to root using the su command. Type your root password when prompted: su
- Edit the sudoers file using the vi editor or any other editor you are comfortable with: visudo
- Scroll down until you find root ALL=(ALL) ALL and add the following line below it. Replace with your actual user name.
<your username> ALL=(ALL) ALL
- Log out and back in (or reboot) the system for the change to take effect.