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
- Fix “sudo command not found”
- Install a Specific Version with apt-get on Ubuntu/Debian
- Fix Ubuntu/Debian apt-get “KEYEXPIRED: The following signatures were invalid”
- How to Test a Cron Job
- How to Unzip Into a Folder
- How to Show Your Elasticsearch Version on Ubuntu/Debian
- Use “which” in Linux to find the Location of an Exetable
- Sort “ls” by Last Changed Date
- How to Shutdown a Machine
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
.