Skip to content
FR
  1. LuzineDebug
  2. Systems (Windows, macOS, Linux)
  3. user is not in the sudoers file. This incident w…
Systems (Windows, macOS, Linux) Beginner ≈ 5 min to fix

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

Error message
user is not in the sudoers file. This incident will be reported.
  • alice is not in the sudoers file. This incident will be reported.
  • alice is not in the sudoers file.
  • alice is not allowed to run sudo on myhost. This incident will be reported.
  • Sorry, user alice is not allowed to execute '/usr/bin/apt update' as root on myhost.
  • Sorry, user alice may not run sudo on myhost.
In short

Your account is not allowed to use sudo: it is neither in the admin group (sudo on Debian and Ubuntu, wheel on Fedora, RHEL and Arch) nor in a rule in /etc/sudoers. Log in as root, add the user to the group with usermod -aG, then log out and back in.

Be the first to confirm this fix

What this error means

sudo reads /etc/sudoers and the files in /etc/sudoers.d/ to know who may run what. Distributions grant a whole group there: %sudo on Debian and Ubuntu, %wheel on Fedora, RHEL and Arch, %admin on macOS. If your user matches no rule, sudo refuses and writes the attempt to the system log: that is what "This incident will be reported" means. Recent sudo versions no longer print that second sentence. A plain sudo command cannot fix this: you must act from an account that already has root rights.

Common causes

  1. Debian installed with a root password: if you set a root password during installation, the first user is not added to the sudo group.
  2. New user created without an admin group: adduser or useradd do not grant sudo rights by default.
  3. Group added but session not reopened: groups are read at login, so the change is not visible in the current session.
  4. Wrong group for the distribution: sudo instead of wheel on Fedora or Arch. On Arch, the %wheel line in sudoers is even commented out by default.

Step-by-step fix

  1. Get a root shell

    With the root password, use su -. On Ubuntu, the root account is locked: use another admin account, or recovery mode (GRUB menu > Advanced options > recovery mode > root), then make the disk writable. Under WSL, open PowerShell and run wsl -u root.

    bash
    # With the root password (Debian, Fedora...)
    su -
    
    # Ubuntu recovery mode: remount the root file system read-write
    mount -o remount,rw /
    
    # WSL (from PowerShell)
    wsl -u root
  2. Add the user to the admin group

    From the root shell, add your user to the right group. The -a option is essential: without it, -G replaces all of the user's secondary groups.

    bash
    # Debian, Ubuntu, Linux Mint
    usermod -aG sudo alice
    
    # Fedora, RHEL, Rocky, AlmaLinux, Arch
    usermod -aG wheel alice
  3. Check the group rule with visudo

    On Arch in particular, uncomment the %wheel line in sudoers. Always edit this file with visudo: it checks the syntax before saving, whereas an error in a hand-edited /etc/sudoers locks sudo for everyone.

    bash
    EDITOR=nano visudo
    # uncomment this line:
    # %wheel ALL=(ALL:ALL) ALL
    
    # Check the whole configuration
    visudo -c
  4. Or create a dedicated rule

    To grant rights to a single user without touching the main file, create a file in /etc/sudoers.d/, always through visudo -f. Avoid NOPASSWD: ALL: any program running under that account could then become root without a password.

    bash
    visudo -f /etc/sudoers.d/alice
    # content:
    alice ALL=(ALL:ALL) ALL
  5. Reopen the session and test

    Log out completely (or close the SSH session) then log back in. Then check that the group shows up and that sudo works.

    bash
    groups
    sudo -v
    sudo -l
  6. macOS: make the account an administrator

    On a Mac, sudo is reserved for administrators. From an admin account, open System Settings > Users & Groups, click the account and turn on "Allow this user to administer this computer", or use dseditgroup.

    bash
    sudo dseditgroup -o edit -a alice -t user admin

Did this fix work for you?

Confirm it in one click: it will rise for the next developers stuck on the same error.

Keep it from coming back

  • Add your user to the admin group right after installing a server, before disabling root login over SSH.
  • When editing sudoers, keep a root shell open and test sudo -v in a second terminal before closing it.
  • Never use a regular editor on /etc/sudoers: always go through visudo.

Frequently asked questions

"This incident will be reported": to whom?

The attempt is recorded in the system logs (journalctl or /var/log/auth.log), and an email may be sent to root if a local mail server is set up. Nobody else is notified.

I do not have the root password on Ubuntu, what can I do?

Use another admin account if there is one. Otherwise, boot into recovery mode from GRUB, choose "root", run mount -o remount,rw /, then usermod -aG sudo your_user.

Do I need to reboot after usermod?

No, logging out and back in is enough. For an SSH session, disconnect and reconnect.

Useful tools for this error

More Systems (Windows, macOS, Linux) errors

All Systems (Windows, macOS, Linux) errors →