If you have tried to run the sudo
command on your Linux system and are greeted with a sudo command not found
error, we have the solution for you. This error most commonly occurs on minimal installs, such as in Docker or on a VPS (virtual private server), and can happen on any Linux distro, like Ubuntu Linux and Debian . In this tutorial, we will show you how to resolve the error and give you the ability to run sudo
commands without error.
In this tutorial you will learn:
- How to install the
sudo
software package - How to add a user to the
sudo
group

Category | Requirements, Conventions or Software Version Used |
---|---|
System | Any Linux distro |
Software | sudo |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
sudo command not found – Solution
The
sudo
command is used to execute commands with root permissions, without actually having to log in to the root account. Any users that have sudo
permissions essentially have root administrative access on your Linux system.
- To resolve the error, the first thing you will need to do is login to the root account.
$ su -
- Next, install the
sudo
software package with the appropriate command below.Debian, Ubuntu: # apt update && apt -y install sudo Fedora, Red Hat, AlmaLinux: # dnf install sudo Arch Linux, Manjaro: # pacman -S sudo
- After the package has installed, you will need to add your regular user to the
sudo
group in order for them to have access to thesudo
command and root permissions. On Red Hat systems, it will be called thewheel
group instead. The following example will add userlinuxconfig
to the group.# usermod -aG sudo linuxconfig Or on Red Hat systems: # usermod -aG wheel linuxconfig
- You should now be able to execute commands with root permissions. Change to your normal user and test.
# su linuxconfig $ sudo whoami root
If you encounter any problems, you may need to reboot and try thesudo
command again.
Closing Thoughts
In this tutorial, we saw how to resolve the sudo command not found
error on a Linux system. This involved installing the sudo
package. Remember to add all users that will need root permissions to the sudo
or wheel
group.