Menu
User

DropVPS Team

Writer: Cooper Reagan

How to Fix: sudo Command Not Found Error

How to Fix: sudo Command Not Found Error

Publication Date

07/05/2025

Category

Articles

Reading Time

2 Min

Table of Contents

If you see the error: sudo: command not found .It means sudo is either not installed or not in your system’s PATH. Here’s how to fix it.

Step 1 – Switch to Root User

Since sudo isn’t available, you’ll need to become root directly:

su -

If you don’t have the root password, you’ll need physical or recovery access to the system.

Step 2 – Install sudo

Now install sudo using your system’s package manager.

On Ubuntu/Debian:

apt update
apt install sudo

On CentOS/RHEL/Fedora:

dnf install sudo

If you’re on an older CentOS version:

yum install sudo

Step 3 – Verify Installation

After installation:

which sudo

Should return:

/usr/bin/sudo

Test it:

sudo ls /

If it prompts for your password and runs the command, you’re good.

Step 4 – Add Your User to sudo Group (If Needed)

Sometimes sudo is installed, but your user isn’t in the right group. You can fix this as root:

On Ubuntu:

usermod -aG sudo your-username

On CentOS:

usermod -aG wheel your-username

Then log out and back in for the change to take effect.

Linux VPS
U
Loading...

Related Posts