Ubuntu/Debian — Fix “sudo command not found”

We recently provisioned a new Debian VM and noticed that the sudo command wasn’t available. Our typical workflow includes the sudo command at the beginning of commands.

The good news: you can install the sudo command on Debian and give your user the “sudo” permissions.

Ubuntu/Debian Series Overview

Install the “sudo” Command

At first, you need to install the sudo command. You can do that using the apt package manager. You need to run this command as a user that has permissions to install packages, like the root user:

apt-get install sudo  

The next step is to give your own user the sudo rights:

user od -AG <your-username>  

You also have to add your user to the sudo group. Open the /etc/sudoer file using your favorite editor, like nano:

# ensure your user is in the sudo group
nano /etc/sudoers  

Check whether the “sudo” group already has all permissions on your system. Search for a line like this:

# Full access for members of the sudo group
%sudo   ALL=(ALL:ALL) ALL

# User privilege specification
root    ALL=(ALL:ALL) ALL  

The percent sign indicates that the following identifier represents the name of a group instead of a user.

That’s it! You should now be able to run any command using sudo.

Explore the Library

Find interesting tutorials and solutions for your problems.