Your account lacks sudo rights (or lost them). The fix requires root access from somewhere — console, another admin, or recovery mode. Then it's one line in sudoers, correctly.
Check membership from a working session: id -nG. Some distros require wheel with an explicit %wheel ALL=(ALL:ALL) ALL line in /etc/sudoers.
Editing /etc/sudoers directly (not via visudo) with a syntax error can nuke all sudo. That's why every guide says visudo.
# cloud provider serial console, or: reboot into single-user/recovery mode, or: su - from an admin session
usermod -aG sudo <user> # debian/ubuntu ; usermod -aG wheel <user> # rhel/fedora/arch
echo '<user> ALL=(ALL:ALL) ALL' | EDITOR='tee' visudo -f /etc/sudoers.d/<user> # validated on save
sudo -v && sudo whoami # expect root
visudo validates syntax before saving — a bad line is rejected, not silently breaking sudo. Passwordless ALL for convenience: '<user> ALL=(ALL) NOPASSWD:ALL' is standard for automation but a real security trade — scope it to specific commands when possible.
No — sudoers changes require root by design. That's the point of the file. Use a provider console, recovery mode, or another admin account.
A direct /etc/sudoers edit with a syntax error makes sudo refuse to run for all users (fail-closed). Boot to recovery, run visudo -c to find the bad line, and fix it there.
Our most-documented failures, packaged as ready-to-ship starter kits: Docker, Kubernetes, and Terraform.
Browse the template store →One-time. Yours to modify. Instant download from the NinjaOps template store.