Attempting to run administrative commands prefixed with sudo in Ubuntu can fail with the security rejection: [username] is not in the sudoers file. This incident will be reported. In Linux systems, the sudoers configuration file (located at /etc/sudoers) dictates which non-root users possess elevated privileges to modify system binaries, install software packages, or edit system services. When a newly created user account has not been explicitly granted administrative membership or assigned to the sudo group, the security daemon terminates execution immediately.
Resolving this authorization issue requires adding the user account to the secondary sudo group using an existing administrator account, switching to the root shell, or booting into Ubuntu Recovery Mode if no administrative access is currently available.
Why Does the Sudoers Incident Warning Occur?
Ubuntu enforces the principle of least privilege. The sudoers warning is logged to system audit files under /var/log/auth.log due to several typical scenarios:
- Standard User Account Creation: The user account was created using the
adduseroruseraddcommand without adding the-G sudoflag, leaving it as an unprivileged standard user. - Corrupted or Overwritten /etc/sudoers File: Direct editing of the configuration file without using the safe
visudosyntax checker introduced syntax errors that caused the sudo daemon to disable group privileges. - Removal from the ‘sudo’ Group: A system administrator or script modified user group memberships using
usermod -Gwithout the append (-a) flag, inadvertently stripping the user of all secondary groups. - Multi-User Desktop Installs: Secondary family or office user accounts were configured as standard desktop users rather than administrators.
Method 1: Add User to the Sudo Group via Root or Admin Account
If you have access to another account that already possesses administrative rights, or if you know the password for the root account:
- Log in to the administrative account, or switch to root in the terminal:
su -(Enter the root password when prompted.)
- Add your unprivileged username to the
sudogroup usingusermod:usermod -aG sudo [username](Replace
[username]with your actual Linux user account name.) - Verify that the user has been successfully assigned to the group:
groups [username]The terminal should display:
[username] : [username] sudo. - Log out and log back in (or run
su - [username]) to apply the updated group token. - Test administrative permissions by running a basic update:
sudo apt update
Method 2: Grant Privileges Using Ubuntu Recovery Mode (No Root Password)
If you are locked out of all administrative accounts on your local Ubuntu machine, use Ubuntu Recovery Mode to access an elevated root terminal:
- Restart your computer.
- Immediately after the BIOS/UEFI splash screen, hold down the Shift key (for BIOS systems) or repeatedly tap the Escape key (for UEFI systems) to bring up the GRUB bootloader menu.
- Select Advanced options for Ubuntu and press Enter.
- Select the entry ending in (recovery mode) and press Enter.
- From the Recovery Menu, use the arrow keys to highlight root – Drop to root shell prompt and press Enter.
- Because recovery mode mounts the filesystem in read-only mode by default, remount it with read-write permissions:
mount -o remount,rw / - Add your user to the sudo group:
usermod -aG sudo [username] - Reboot the system into normal desktop mode:
reboot
Method 3: Safely Configure Sudoers Using visudo
If your distribution uses custom privilege definitions rather than the standard Debian/Ubuntu sudo group, modify the sudoers file directly:
- Never edit
/etc/sudoersusing standard text editors like nano or vim. Always use visudo, which locks the file and validates syntax before saving to prevent fatal lockouts:sudo visudo - Scroll down to the user privilege specification section:
# User privilege specification root ALL=(ALL:ALL) ALL [username] ALL=(ALL:ALL) ALL - Add the line specifying your username as shown above.
- Save and exit (in visudo with nano keybindings, press Ctrl + O, Enter, then Ctrl + X).
Understanding ‘This Incident Will Be Reported’
When Ubuntu displays the message This incident will be reported, the operating system does not transmit details over the internet. Instead, it logs an internal audit event locally in /var/log/auth.log recording the username, terminal session, and rejected command. Once administrative rights are restored via the steps above, these log warnings cease and full command privileges operate normally.