Sudo also called “superuser do” is a command in Linux that allows you to run high-privilege admin commands as a root user. It asked to enter your personal password and confirms your requests by checking a sudoers file.
After a fresh Debian 10 installation, you could not execute the privileges tasks by running the sudo command. You will get the error ‘sudo command not found in Debian 10′. The reason for this error is the sudo command isn’t included in Debian 10 by default.
In this post, we will show you how to fix sudo command not found in Debian 10 VPS.
Table of Contents
Prerequisites
- A fresh Debian 10 VPS.
- Access to the root user account.
Verify Sudo Error
First, log in to your Debian 10 VPS with root user using the SSH command:
ssh root@your-server-ip
After login, run the following command to verify the sudo error:
sudo apt-get update
You should get the following error:
-bash: sudo: command not found
Install the sudo command
By default, sudo package is included in the Debian 10 default repository. You can install it using the apt-get command as shown below:
apt-get install sudo -y
The above command will install a sudo command and create a /etc/sudoers file.
Add an User to the Sudo Group
After installing the Sudo package, you will need to create a new regular user and add it to the sudo group.
First, create a new user using the following command:
adduser user1
Output:
Adding user `user1' ... Adding new group `user1' (1000) ... Adding new user `user1' (1000) with group `user1' ... Creating home directory `/home/user1' ... Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully Changing the user information for user1 Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n]
Next, add your newly created user to the sudo group:
usermod -aG sudo user1
This command will grants sudo privileges to the user1 and allow it to use the sudo command to perform administrative privileges.
Next, verify whether the user has been added to the sudo group using the following command:
id user1
You should see that the user user1 belongs to two groups: user1 and sudo.
uid=1000(user1) gid=1000(user1) groups=1000(user1),27(sudo)
Now, switch the user to user1 and execute any command using the sudo:
su - user1 sudo apt-get update
We hope you are now able to fix the sudo command not found error in Debian 10 VPS.
Of course, you don’t have to fix the sudo error if you use one of our Managed VPS Hosting services, in which case you can simply ask our expert Linux admins to install fix the sudo error on Debian 10 VPS, for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post on how to fix the sudo error on Debian 10 VPS, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
Thanks for your precious help.