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
- How to add a user to the
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
sudo command not found – Solution
sudocommand is used to execute commands with root permissions, without actually having to log in to the root account. Any users that have
sudopermissions 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
sudosoftware 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
sudogroup in order for them to have access to the
sudocommand and root permissions. On Red Hat systems, it will be called the
wheelgroup instead. The following example will add user
linuxconfigto 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 the
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