Linux: User Is Not in the Sudoers File

You run sudo and Linux says you're 'not in the sudoers file' — with an ominous note about being reported. It just means your account lacks admin rights. Here's how to grant them (from an account that has them).

BytExplorer 5 min read July 1, 2026

You try to run something with sudo and get:

user is not in the sudoers file. This incident will be reported.

The scary second sentence just means the failed attempt was logged — nothing is coming for you. The real message is the first line: your user account doesn't have permission to use sudo, so it can't run commands as root. Fixing it means granting that permission — which, by design, has to be done from an account that already has it.

The catch: you need existing admin access

You can't grant yourself sudo using sudo — that's the whole point of the restriction. You need one of:

  • The root account (su -, if root has a password), or
  • Another user who already has sudo, or
  • Console/recovery access on your own machine.

Without one of those, only whoever administers the box can add you.

Step 1: Become an admin

su -            # switch to root (enter root's password)

Step 2: Add your user to the sudo group

Membership in one group is what grants sudo. It's sudo on Debian/Ubuntu and wheel on Fedora/RHEL:

usermod -aG sudo yourname     # Debian/Ubuntu
# usermod -aG wheel yourname  # Fedora/RHEL/Rocky

The -aG matters: -a appends the group. Leaving off -a replaces all your groups — a classic way to lock yourself out further.

Step 3: Start a fresh session

Group changes only apply to new logins. Log out and back in, then confirm:

sudo whoami     # prints 'root' if it now works

The "will be reported" line is just an audit log entry, not a threat. The fix is always: get to an admin account, add your user to sudo/wheel, re-login.

The checklist

  1. It means your account lacks sudo rights (the "reported" bit is harmless logging).
  2. You need root or another sudo user to fix it — you can't self-grant.
  3. usermod -aG sudo <user> (or wheel on RHEL) — keep the -a.
  4. Log out and back in, then test with sudo whoami.

Frequently Asked Questions

What does "user is not in the sudoers file. This incident will be reported" mean? Your account isn't authorised to run commands with sudo, and the failed attempt was logged. It's a permissions message, not a security breach.

How do I add a user to sudo? As root, add them to the admin group: usermod -aG sudo <user> on Debian/Ubuntu, or usermod -aG wheel <user> on RHEL/Fedora. Then log out and back in for it to take effect.

I can't use sudo to fix it — what now? Log in as root directly, or use su - if you know the root password, make the group change, then return to your user. On a cloud VM, use the provider's web console or root recovery.

Put it into practice

Stop reading, start building

This pairs with a hands-on BytExplorer course — do it on your own machine and actually keep the skill.

More in Troubleshooting