How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu
How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu

How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu

How To Fix Broken sudo Command in Ubuntu

If you happen to be running only Ubuntu on your machine, after powering it, press the Shift key for a few seconds to get the Grub boot menu. On the other hand, if you are running a dual-boot (Ubuntu alongside Windows or Mac OS X), then you should see the Grub boot menu by default.

Using the Down Arrow, select “Advanced options for Ubuntu” and press Enter.

You will be at the interface below, select the kernel with the “recovery mode” option as below and press Enter to advance to the “Recovery menu”.

Below is the “Recovery menu”, indicating that the root filesystem is mounted as read-only. Move over to the line “root Drop to root shell prompt”, then hit Enter.

Next, press Enter for maintenance:

At this point, you should be at the root shell prompt. As we had seen before, the filesystem is mounted as read-only, therefore, to make changes to the system we need to remount it as read/write by running the command below:

# mount -o rw,remount /

Assuming that a user has been removed from the sudo group, to add the user back to the sudo group issue the command below:

# adduser username sudo

And finally, reboot the system as normal, everything should be fine now.