How to fix "user is not in the sudoers file"

Fix "user is not in the sudoers file" on Linux: add the user to the sudo or wheel group as root, log in again, what to do without root access, and why to edit sudoers only with visudo.

  • 1:05 video
  • English captions & transcript
  • 20 October 2026

Transcript

The full narration, chapter by chapter. Click a time to play the video from there.

Intro

Seeing "user is not in the sudoers file"? Your account just isn't allowed to use sudo yet. Here's how to fix it, safely.

What it means

It means exactly that: your user isn't in the admin group, so sudo refuses to run.

Add to the group

Log in as root, or with another user that has sudo. Then add your user to the admin group. On Debian or Ubuntu, that's usermod -aG sudo yourusername. On AlmaLinux or Rocky, the group is wheel.

Log in again

Now log out, and log back in. Group changes only apply to new sessions. Then try sudo again.

Locked out?

No root access at all? Use the console in your client area, or rescue mode. Never edit the sudoers file directly. Use visudo, which checks the file before saving. And if sudo itself is missing, install it as root.

Recap

That's it: add the user to sudo or wheel, log in again, and edit with visudo. More Linux guides at esagames.ro.

More video tutorials

  • 1:22
    Linux & VPS

    How to connect to your server with SSH

    How to connect to a VPS or dedicated server with SSH from Windows: what you need, opening Terminal, the ssh command, the first-time fingerprint, the invisible password, and what to do if it fails.

  • 1:23
    Linux & VPS

    How to upload files with SFTP (FileZilla)

    Upload files to your server with SFTP and FileZilla: install FileZilla, find your SFTP details on a game server or a VPS, connect with Quickconnect, upload, and restart.

  • 1:14
    Minecraft

    How to fix "Failed to login: Invalid session" in Minecraft

    Why Minecraft says "Failed to login: Invalid session" and how to fix it: restart the launcher, sign in again for a fresh token, the server-side online-mode check, and what to do if it keeps coming back.

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.