In this article, we will show you how to fix sudo command not found in Debian 10 VPS.
Sudo is a program for Unix-like computer operating systems that enables users to run programs with the security privileges of another user, by default the superuser.It can stand for “superuser do”, as originally that is all it did however, now it might stand for “substitute user, do”, because sudo can run a command as other users as well.
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′.
fix sudo command not found in Debian 10 VPS
Log in to your Debian 10 server with root user.
After login, run the following command to verify the sudo error:
sudo apt update
You’ll get the following error:
-bash: sudo: command not found
By default, sudo package is in the Debian 10 default repository. You can install it using the apt command as shown below:
apt install sudo -y
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:
Now, add your newly created user to the sudo group:
usermod -aG sudo sajid
This command will grants sudo privileges to the sajid and allow it to use the sudo command to perform administrative privileges.
You can also verify whether the user has been added to the sudo group using the following command:
Then, you should see that the user user1 belongs to two groups: sajid and sudo.
uid=1002(sajid) gid=1002(sajid) groups=1002(sajid),27(sudo)
Now, switch the user to user1 and execute any command using the sudo:
su - sajid
sudo apt update
So, you are now able to fix the sudo command not found error in Debian 10 virtual private server. Enjoy it.