It means you don’t have “/usr/bin/” setup in the PATH variable or your /etc/environment file got messed up. If you have a sudo package installed as explained in Step 1.1 and still you are getting sudo command not found error. Solution2 – Setup path variable to fix sudo command not found errors Now you will not get any “ sudo command not found error” as it’s fixed now. Press Ctrl + X and press “ Y” to save the file and exit from the nano editor.Įxit from the root shell and check the sudo command functionality. Run visudocommand to modify sudoers file and add the following line into it (if it is missing): # Allow members of group sudo to execute any command.# more /etc/group | grep -i username Step1.6 Make sure your sudoers file have sudo group added I will check for my user “ dev” in this example. Open /etc/passwd file and check whether your user is added to the sudo group or not. Step1.4 Give sudo rights to your own user by adding it to the sudo group # usermod -aG sudo yourusernameįor example, I will add my user “dev” to sudo group – # usermode -aG sudo dev Step1.5 Verify your user is added to the sudo group ![]() Refer to the following image for reference. Step1.3 Run apt command to install sudo package in Ubuntu/Debian # apt install sudo If you don’t have a root password, then follow this link to reset your root password. You would need root access to achieve this. If you don’t have the sudo package installed, run the following command to install it in Ubuntu or Debian based distros. Then you can directly move to solution-2 to fix the “ sudo: command not found error“. If you can find package name sudo with “ installed” status as shown in the image. Follow these steps to fix it – Step1.1 List installed packages in Ubuntu and look for the “sudo” package $ apt list -installed | grep -i sudo Still, you may get this situation when you have installed the Debian Linux with the minimal package. This is very uncommon when sudo is not installed by default with Linux installation. Let’s deep dive and find the fixes for different scenarios – Solution-1 Check and install sudo package I am running this command in Ubuntu 21.04 installed as VM. As you will see in the image, running the “sudo ifconfig -a” command results in “ bash: /usr/bin/sudo: No such file or directory error“. How to fix sudo command not found error in Debian/Ubuntu like DistrosĪs we discussed already, there may be many reasons to encounter this error. The “ sudoers” file controls, who can use the sudo command to gain elevated access and location is /etc/sudoers in all Linux distributions. Also, the operations which are only permitted by a root user can be done using a normal user with sudo rights. It allows running any Linux command with elevated privileges to run administrative tasks. Sudois one of the famous prefixes to any command you run in the Linux world.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |